From 9afb181fef625f8ad00b0011a4f2b2e1dce8eb29 Mon Sep 17 00:00:00 2001 From: Eugeni Dodonov Date: Mon, 22 Feb 2010 17:35:25 +0000 Subject: Do not check subtrees of excluded entries --- src/msec_find/find.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/msec_find') diff --git a/src/msec_find/find.c b/src/msec_find/find.c index 3959ea9..a4ecff7 100644 --- a/src/msec_find/find.c +++ b/src/msec_find/find.c @@ -37,6 +37,7 @@ #include #define __USE_XOPEN_EXTENDED +#define __USE_GNU #include #include @@ -85,11 +86,10 @@ static int traverse(const char *file, const struct stat *sb, int flag, struct FT if ( (strncmp("/proc", file, 5) == 0) || (strncmp("/dev", file, 4) == 0) || (strncmp("/sys", file, 4) == 0) ) - return 0; + return FTW_SKIP_SUBTREE; - if (use_regexp && (regexec(&exclude_regexp, file, 0, NULL, 0) == 0)) { - return 0; - } + if (use_regexp && (regexec(&exclude_regexp, file, 0, NULL, 0) == 0)) + return FTW_SKIP_SUBTREE; switch (flag) { /* @@ -223,7 +223,7 @@ int main(int argc, char **argv) directory = argv[i]; } - res = nftw(directory, traverse, 200, FTW_PHYS | FTW_MOUNT); + res = nftw(directory, traverse, 200, FTW_PHYS | FTW_MOUNT | FTW_ACTIONRETVAL); if ( ctrl ) { free(directory); -- cgit v1.2.1