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:
parent
0daba6bd43
commit
8536a97920
@ -254,9 +254,16 @@ updateInDirectory(struct directory *directory, const char *name)
|
|||||||
} else if (S_ISDIR(st.st_mode)) {
|
} else if (S_ISDIR(st.st_mode)) {
|
||||||
struct directory *subdir = directory_get_child(directory, name);
|
struct directory *subdir = directory_get_child(directory, name);
|
||||||
if (subdir) {
|
if (subdir) {
|
||||||
|
enum update_return ret;
|
||||||
|
|
||||||
assert(directory == subdir->parent);
|
assert(directory == subdir->parent);
|
||||||
directory_set_stat(subdir, &st);
|
directory_set_stat(subdir, &st);
|
||||||
return updateDirectory(subdir);
|
|
||||||
|
ret = updateDirectory(subdir);
|
||||||
|
if (ret == UPDATE_RETURN_ERROR)
|
||||||
|
delete_directory(subdir);
|
||||||
|
|
||||||
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
return addSubDirectoryToDirectory(directory, name, &st);
|
return addSubDirectoryToDirectory(directory, name, &st);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user