Commit ebaa3f43 authored by J. Alexander Treuman's avatar J. Alexander Treuman

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
parent 179ab7ef
...@@ -1091,6 +1091,7 @@ int writeDirectoryDB(void) ...@@ -1091,6 +1091,7 @@ int writeDirectoryDB(void)
{ {
FILE *fp; FILE *fp;
char *dbFile = getDbFile(); char *dbFile = getDbFile();
struct stat st;
DEBUG("removing empty directories from DB\n"); DEBUG("removing empty directories from DB\n");
deleteEmptyDirectoriesInDirectory(mp3rootDirectory); deleteEmptyDirectoriesInDirectory(mp3rootDirectory);
...@@ -1101,7 +1102,7 @@ int writeDirectoryDB(void) ...@@ -1101,7 +1102,7 @@ int writeDirectoryDB(void)
DEBUG("writing DB\n"); DEBUG("writing DB\n");
while (!(fp = fopen(dbFile, "w")) && errno == EINTR) ; while (!(fp = fopen(dbFile, "w")) && errno == EINTR);
if (!fp) { if (!fp) {
ERROR("unable to write to db file \"%s\": %s\n", ERROR("unable to write to db file \"%s\": %s\n",
dbFile, strerror(errno)); dbFile, strerror(errno));
...@@ -1116,7 +1117,10 @@ int writeDirectoryDB(void) ...@@ -1116,7 +1117,10 @@ int writeDirectoryDB(void)
writeDirectoryInfo(fp, mp3rootDirectory); 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; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment