aboutsummaryrefslogtreecommitdiffstats
path: root/src/database.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/database.c b/src/database.c
index 4010955b7..a90c22a98 100644
--- a/src/database.c
+++ b/src/database.c
@@ -268,9 +268,11 @@ db_load(void)
}
/* get initial info */
- if (!myFgets(buffer, sizeof(buffer), fp))
+ if (!fgets(buffer, sizeof(buffer), fp))
FATAL("Error reading db, fgets\n");
+ g_strchomp(buffer);
+
if (0 != strcmp(DIRECTORY_INFO_BEGIN, buffer)) {
ERROR("db info not found in db file\n");
ERROR("you should recreate the db using --create-db\n");
@@ -278,8 +280,10 @@ db_load(void)
return -1;
}
- while (myFgets(buffer, sizeof(buffer), fp) &&
- 0 != strcmp(DIRECTORY_INFO_END, buffer)) {
+ while (fgets(buffer, sizeof(buffer), fp) &&
+ !g_str_has_prefix(buffer, DIRECTORY_INFO_END)) {
+ g_strchomp(buffer);
+
if (g_str_has_prefix(buffer, DIRECTORY_MPD_VERSION)) {
if (foundVersion)
FATAL("already found version in db\n");