aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-09 15:47:59 +0200
committerEric Wong <normalperson@yhbt.net>2008-10-11 19:21:50 -0700
commit50f1074c1b0b156e484401c6455e881cd830c2f7 (patch)
tree77f680c6a2816f9db344e2d5597f23c6ef04c7fc
parent189e7bbfe4ca060bc26bc917bd65b71a38851d13 (diff)
downloadmpd-50f1074c1b0b156e484401c6455e881cd830c2f7.tar.gz
mpd-50f1074c1b0b156e484401c6455e881cd830c2f7.tar.xz
mpd-50f1074c1b0b156e484401c6455e881cd830c2f7.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.
-rw-r--r--src/update.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/update.c b/src/update.c
index 73ab142c1..dd48bfe78 100644
--- a/src/update.c
+++ b/src/update.c
@@ -243,9 +243,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);
}