diff options
author | Max Kellermann <max@duempel.org> | 2008-10-09 19:15:56 +0200 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-10-11 19:21:51 -0700 |
commit | 01bf8687f27db7d4ddec019a606670d43ec14680 (patch) | |
tree | 21613130569fb15ea6be0020d2b448bdebf0f304 | |
parent | 120aa4bfb5c0b6962ee50559c0263f8e850f2c88 (diff) | |
download | mpd-01bf8687f27db7d4ddec019a606670d43ec14680.tar.gz mpd-01bf8687f27db7d4ddec019a606670d43ec14680.tar.xz mpd-01bf8687f27db7d4ddec019a606670d43ec14680.zip |
update: do the recursive directory check only once
The recursive checks were performed in several functions, and
sometimes a directory was checked twice.
-rw-r--r-- | src/update.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/update.c b/src/update.c index c8eb33b6d..5b2721cdb 100644 --- a/src/update.c +++ b/src/update.c @@ -224,9 +224,6 @@ addSubDirectoryToDirectory(struct directory *directory, { struct directory *subDirectory; - if (inodeFoundInParent(directory, st->st_ino, st->st_dev)) - return UPDATE_RETURN_NOUPDATE; - subDirectory = directory_new(name, directory); if (updateDirectory(subDirectory, st) != UPDATE_RETURN_UPDATED) { directory_free(subDirectory); @@ -260,8 +257,12 @@ updateInDirectory(struct directory *directory, return UPDATE_RETURN_UPDATED; } } else if (S_ISDIR(st->st_mode)) { - struct directory *subdir = directory_get_child(directory, name); - if (subdir) { + struct directory *subdir; + + if (inodeFoundInParent(directory, st->st_ino, st->st_dev)) + return UPDATE_RETURN_ERROR; + + if ((subdir = directory_get_child(directory, name))) { enum update_return ret; assert(directory == subdir->parent); @@ -302,10 +303,6 @@ updateDirectory(struct directory *directory, const struct stat *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)); if (!dir) return UPDATE_RETURN_ERROR; |