diff options
author | Max Kellermann <max@duempel.org> | 2008-10-09 15:47:59 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-09 15:47:59 +0200 |
commit | 8536a979202622bf8cda9c3cf4775f3dfb7ae4ac (patch) | |
tree | a34892cf3a8f8514820d8ad853e7e74259c7ff1b | |
parent | 0daba6bd4342f1f080a35ca0da3d8ec63edef51f (diff) | |
download | mpd-8536a979202622bf8cda9c3cf4775f3dfb7ae4ac.tar.gz mpd-8536a979202622bf8cda9c3cf4775f3dfb7ae4ac.tar.xz mpd-8536a979202622bf8cda9c3cf4775f3dfb7ae4ac.zip |
update: delete directory after failed update
When a directory cannot be updated, there must be something wrong with
it, and the database contains stale data. Remove it.
Diffstat (limited to '')
-rw-r--r-- | src/update.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/update.c b/src/update.c index b93aadc5d..104f73400 100644 --- a/src/update.c +++ b/src/update.c @@ -254,9 +254,16 @@ updateInDirectory(struct directory *directory, const char *name) } else if (S_ISDIR(st.st_mode)) { struct directory *subdir = directory_get_child(directory, name); if (subdir) { + enum update_return ret; + assert(directory == subdir->parent); directory_set_stat(subdir, &st); - return updateDirectory(subdir); + + ret = updateDirectory(subdir); + if (ret == UPDATE_RETURN_ERROR) + delete_directory(subdir); + + return ret; } else { return addSubDirectoryToDirectory(directory, name, &st); } |