aboutsummaryrefslogtreecommitdiffstats
path: root/src/database.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-07 16:20:07 +0100
committerMax Kellermann <max@duempel.org>2009-11-07 16:20:07 +0100
commitc422344190836878e1229fdf85ca102d9fc40374 (patch)
treeec72d25c8adaa445794e1d740005ba630279fe58 /src/database.c
parent1a4cfc3d90b1ac3cc612d3f610caadb04179820c (diff)
downloadmpd-c422344190836878e1229fdf85ca102d9fc40374.tar.gz
mpd-c422344190836878e1229fdf85ca102d9fc40374.tar.xz
mpd-c422344190836878e1229fdf85ca102d9fc40374.zip
database: I/O error handling in db_save()
Check ferror() instead of the fprintf() return value.
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/database.c b/src/database.c
index 70fce0c18..2164a69b7 100644
--- a/src/database.c
+++ b/src/database.c
@@ -251,7 +251,9 @@ db_save(void)
fprintf(fp, "%s\n", DIRECTORY_INFO_END);
- if (directory_save(fp, music_root) < 0) {
+ directory_save(fp, music_root);
+
+ if (ferror(fp)) {
g_warning("Failed to write to database file: %s",
strerror(errno));
while (fclose(fp) && errno == EINTR);