aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ. Alexander Treuman <jat@spatialrift.net>2007-04-25 20:34:30 +0000
committerJ. Alexander Treuman <jat@spatialrift.net>2007-04-25 20:34:30 +0000
commitebaa3f4338760491dc7d401b7e1cb06bd9ad3307 (patch)
treee0983435e5edbf37b631f5046e52b6db3c0b8c1e /src
parent179ab7efe8f110c9b4f7357875677df43ae79ffd (diff)
downloadmpd-ebaa3f4338760491dc7d401b7e1cb06bd9ad3307.tar.gz
mpd-ebaa3f4338760491dc7d401b7e1cb06bd9ad3307.tar.xz
mpd-ebaa3f4338760491dc7d401b7e1cb06bd9ad3307.zip
Set directory_dbModTime when writing the db, so that it will be set after
initial db creation. git-svn-id: https://svn.musicpd.org/mpd/trunk@5948 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src')
-rw-r--r--src/directory.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/directory.c b/src/directory.c
index 27a0bd2e6..43843f302 100644
--- a/src/directory.c
+++ b/src/directory.c
@@ -1091,6 +1091,7 @@ int writeDirectoryDB(void)
{
FILE *fp;
char *dbFile = getDbFile();
+ struct stat st;
DEBUG("removing empty directories from DB\n");
deleteEmptyDirectoriesInDirectory(mp3rootDirectory);
@@ -1101,7 +1102,7 @@ int writeDirectoryDB(void)
DEBUG("writing DB\n");
- while (!(fp = fopen(dbFile, "w")) && errno == EINTR) ;
+ while (!(fp = fopen(dbFile, "w")) && errno == EINTR);
if (!fp) {
ERROR("unable to write to db file \"%s\": %s\n",
dbFile, strerror(errno));
@@ -1116,7 +1117,10 @@ int writeDirectoryDB(void)
writeDirectoryInfo(fp, mp3rootDirectory);
- while (fclose(fp) && errno == EINTR) ;
+ while (fclose(fp) && errno == EINTR);
+
+ if (stat(dbFile, &st) == 0)
+ directory_dbModTime = st.st_mtime;
return 0;
}