Commit 8536a979 authored by Max Kellermann's avatar Max Kellermann

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.
parent 0daba6bd
......@@ -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);
}
......
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