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.
This commit is contained in:
Max Kellermann 2008-10-09 15:47:59 +02:00
parent 0daba6bd43
commit 8536a97920

View File

@ -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);
}