diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2020-07-01 12:19:05 +0300 |
---|---|---|
committer | Xavi Hernandez <xhernandez@redhat.com> | 2020-07-07 12:39:31 +0000 |
commit | 0a2de3f7f9aafadf0b20197eae2be96275271b97 (patch) | |
tree | e8eec5a7ca329d2859570e152b49b5e645821493 /libglusterfs/src/common-utils.c | |
parent | 27f5c8ba844e9da54fc1304df4ffe015a3bbb9bd (diff) |
libglusterfs, glusterd: tweak directory scanning
Replace an over-engineered GF_SKIP_IRRELEVANT_ENTRIES() with
inline function gf_irrelevant_entry(), adjust related users.
Change-Id: I6f66c460f22a82dd9ebeeedc2c55fdbc10f4eec5
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Fixes: #1350
Diffstat (limited to 'libglusterfs/src/common-utils.c')
-rw-r--r-- | libglusterfs/src/common-utils.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 81c39959406..4ca7ada59a1 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -4707,8 +4707,9 @@ recursive_rmdir(const char *delete_path) goto out; } - GF_SKIP_IRRELEVANT_ENTRIES(entry, dir, scratch); - while (entry) { + while ((entry = sys_readdir(dir, scratch))) { + if (gf_irrelevant_entry(entry)) + continue; snprintf(path, PATH_MAX, "%s/%s", delete_path, entry->d_name); ret = sys_lstat(path, &st); if (ret == -1) { @@ -4734,8 +4735,6 @@ recursive_rmdir(const char *delete_path) gf_msg_debug(this->name, 0, "%s %s", ret ? "Failed to remove" : "Removed", entry->d_name); - - GF_SKIP_IRRELEVANT_ENTRIES(entry, dir, scratch); } ret = sys_closedir(dir); |