update: do the recursive directory check only once
The recursive checks were performed in several functions, and sometimes a directory was checked twice.
This commit is contained in:
parent
a9799218ab
commit
78899051c0
14
src/update.c
14
src/update.c
@ -235,9 +235,6 @@ addSubDirectoryToDirectory(struct directory *directory,
|
|||||||
{
|
{
|
||||||
struct directory *subDirectory;
|
struct directory *subDirectory;
|
||||||
|
|
||||||
if (inodeFoundInParent(directory, st->st_ino, st->st_dev))
|
|
||||||
return UPDATE_RETURN_NOUPDATE;
|
|
||||||
|
|
||||||
subDirectory = directory_new(name, directory);
|
subDirectory = directory_new(name, directory);
|
||||||
if (updateDirectory(subDirectory, st) != UPDATE_RETURN_UPDATED) {
|
if (updateDirectory(subDirectory, st) != UPDATE_RETURN_UPDATED) {
|
||||||
directory_free(subDirectory);
|
directory_free(subDirectory);
|
||||||
@ -273,7 +270,12 @@ updateInDirectory(struct directory *directory,
|
|||||||
return UPDATE_RETURN_UPDATED;
|
return UPDATE_RETURN_UPDATED;
|
||||||
}
|
}
|
||||||
} 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;
|
||||||
|
|
||||||
|
if (inodeFoundInParent(directory, st->st_ino, st->st_dev))
|
||||||
|
return UPDATE_RETURN_ERROR;
|
||||||
|
|
||||||
|
subdir = directory_get_child(directory, name);
|
||||||
if (subdir) {
|
if (subdir) {
|
||||||
enum update_return ret;
|
enum update_return ret;
|
||||||
|
|
||||||
@ -314,10 +316,6 @@ updateDirectory(struct directory *directory, const struct stat *st)
|
|||||||
|
|
||||||
directory_set_stat(directory, st);
|
directory_set_stat(directory, st);
|
||||||
|
|
||||||
if (inodeFoundInParent(directory->parent,
|
|
||||||
directory->inode, directory->device))
|
|
||||||
return UPDATE_RETURN_ERROR;
|
|
||||||
|
|
||||||
dir = opendir(opendir_path(path_max_tmp, dirname));
|
dir = opendir(opendir_path(path_max_tmp, dirname));
|
||||||
if (!dir)
|
if (!dir)
|
||||||
return UPDATE_RETURN_ERROR;
|
return UPDATE_RETURN_ERROR;
|
||||||
|
Loading…
Reference in New Issue
Block a user