aboutsummaryrefslogtreecommitdiffstats
path: root/src/database.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/database.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/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");