aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/directory.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/directory.c b/src/directory.c
index 773b16db6..54f1af09c 100644
--- a/src/directory.c
+++ b/src/directory.c
@@ -860,10 +860,12 @@ int writeDirectoryDB(void)
DIRECTORY_FS_CHARSET "%s\n"
DIRECTORY_INFO_END "\n", getFsCharset());
- if (writeDirectoryInfo(fd, music_root) < 0)
+ if (writeDirectoryInfo(fd, music_root) < 0) {
ERROR("Failed to write to database file: %s\n",
strerror(errno));
- return -1;
+ xclose(fd);
+ return -1;
+ }
xclose(fd);
if (stat(dbFile, &st) == 0)