aboutsummaryrefslogtreecommitdiffstats
path: root/src/directory_save.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-12-28 19:54:49 +0100
committerMax Kellermann <max@duempel.org>2008-12-28 19:54:49 +0100
commit859aac7242fe3767c19c1bfff73d5e6159cbad31 (patch)
tree2e433f6ec1a820d99ad171ffd6a49a6828ddd0e4 /src/directory_save.c
parent2598cdd86814c7792a431470a9143d609399697b (diff)
downloadmpd-859aac7242fe3767c19c1bfff73d5e6159cbad31.tar.gz
mpd-859aac7242fe3767c19c1bfff73d5e6159cbad31.tar.xz
mpd-859aac7242fe3767c19c1bfff73d5e6159cbad31.zip
utils: removed myFgets()
Replaced myFgets() with fgets() + g_strchomp().
Diffstat (limited to '')
-rw-r--r--src/directory_save.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/directory_save.c b/src/directory_save.c
index 352b808cf..289f6df3b 100644
--- a/src/directory_save.c
+++ b/src/directory_save.c
@@ -66,25 +66,27 @@ void
directory_load(FILE *fp, struct directory *directory)
{
char buffer[MPD_PATH_MAX * 2];
- int bufferSize = MPD_PATH_MAX * 2;
char key[MPD_PATH_MAX * 2];
char *name;
- while (myFgets(buffer, bufferSize, fp)
+ while (fgets(buffer, sizeof(buffer), fp)
&& !g_str_has_prefix(buffer, DIRECTORY_END)) {
if (g_str_has_prefix(buffer, DIRECTORY_DIR)) {
struct directory *subdir;
+ g_strchomp(buffer);
strcpy(key, &(buffer[strlen(DIRECTORY_DIR)]));
- if (!myFgets(buffer, bufferSize, fp))
+ if (!fgets(buffer, sizeof(buffer), fp))
FATAL("Error reading db, fgets\n");
/* for compatibility with db's prior to 0.11 */
if (g_str_has_prefix(buffer, DIRECTORY_MTIME)) {
- if (!myFgets(buffer, bufferSize, fp))
+ if (!fgets(buffer, sizeof(buffer), fp))
FATAL("Error reading db, fgets\n");
}
+
if (!g_str_has_prefix(buffer, DIRECTORY_BEGIN))
FATAL("Error reading db at line: %s\n", buffer);
+ g_strchomp(buffer);
name = &(buffer[strlen(DIRECTORY_BEGIN)]);
if (!g_str_has_prefix(name, directory->path) != 0)
FATAL("Wrong path in database: '%s' in '%s'\n",