summaryrefslogtreecommitdiff
path: root/findutils
diff options
context:
space:
mode:
authorPaul Fox2006-03-27 16:42:33 +0000
committerPaul Fox2006-03-27 16:42:33 +0000
commit8416a2d5585719266417043640ebc4016e38fdc3 (patch)
tree4c087ab1d5c230eb21427a24d599475c8ac0220b /findutils
parent3570915769efcc520f0f14b094c1d4c4e137fa6c (diff)
downloadbusybox-8416a2d5585719266417043640ebc4016e38fdc3.zip
busybox-8416a2d5585719266417043640ebc4016e38fdc3.tar.gz
prevent find from ever descending into an xdev'ed directory.
Diffstat (limited to 'findutils')
-rw-r--r--findutils/find.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/findutils/find.c b/findutils/find.c
index c6aaf7a..7a71af9 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -79,6 +79,15 @@ static int exec_opt;
static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
{
+#ifdef CONFIG_FEATURE_FIND_XDEV
+ if (S_ISDIR(statbuf->st_mode) && xdev_count) {
+ int i;
+ for (i=0; i<xdev_count; i++) {
+ if (xdev_dev[i] != statbuf->st_dev)
+ return SKIP;
+ }
+ }
+#endif
if (pattern != NULL) {
const char *tmp = strrchr(fileName, '/');
@@ -125,21 +134,6 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
goto no_match;
}
#endif
-#ifdef CONFIG_FEATURE_FIND_XDEV
- if (xdev_count) {
- int i;
- for (i=0; i<xdev_count; i++) {
- if (xdev_dev[i] == statbuf-> st_dev)
- break;
- }
- if (i == xdev_count) {
- if(S_ISDIR(statbuf->st_mode))
- return SKIP;
- else
- goto no_match;
- }
- }
-#endif
#ifdef CONFIG_FEATURE_FIND_NEWER
if (newer_mtime != 0) {
time_t file_age = newer_mtime - statbuf->st_mtime;