From 8536a979202622bf8cda9c3cf4775f3dfb7ae4ac Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 9 Oct 2008 15:47:59 +0200 Subject: 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. --- src/update.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); } -- cgit v1.2.3