aboutsummaryrefslogtreecommitdiff
path: root/findutils/find.c
diff options
context:
space:
mode:
authorPaul Fox <pgf@brightstareng.com>2006-03-27 16:42:33 +0000
committerPaul Fox <pgf@brightstareng.com>2006-03-27 16:42:33 +0000
commit8416a2d5585719266417043640ebc4016e38fdc3 (patch)
tree4c087ab1d5c230eb21427a24d599475c8ac0220b /findutils/find.c
parent3570915769efcc520f0f14b094c1d4c4e137fa6c (diff)
downloadbusybox-w32-8416a2d5585719266417043640ebc4016e38fdc3.tar.gz
busybox-w32-8416a2d5585719266417043640ebc4016e38fdc3.tar.bz2
busybox-w32-8416a2d5585719266417043640ebc4016e38fdc3.zip
prevent find from ever descending into an xdev'ed directory.
Diffstat (limited to 'findutils/find.c')
-rw-r--r--findutils/find.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/findutils/find.c b/findutils/find.c
index c6aaf7aab..7a71af9eb 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -79,6 +79,15 @@ static int exec_opt;
79 79
80static int fileAction(const char *fileName, struct stat *statbuf, void* junk) 80static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
81{ 81{
82#ifdef CONFIG_FEATURE_FIND_XDEV
83 if (S_ISDIR(statbuf->st_mode) && xdev_count) {
84 int i;
85 for (i=0; i<xdev_count; i++) {
86 if (xdev_dev[i] != statbuf->st_dev)
87 return SKIP;
88 }
89 }
90#endif
82 if (pattern != NULL) { 91 if (pattern != NULL) {
83 const char *tmp = strrchr(fileName, '/'); 92 const char *tmp = strrchr(fileName, '/');
84 93
@@ -125,21 +134,6 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
125 goto no_match; 134 goto no_match;
126 } 135 }
127#endif 136#endif
128#ifdef CONFIG_FEATURE_FIND_XDEV
129 if (xdev_count) {
130 int i;
131 for (i=0; i<xdev_count; i++) {
132 if (xdev_dev[i] == statbuf-> st_dev)
133 break;
134 }
135 if (i == xdev_count) {
136 if(S_ISDIR(statbuf->st_mode))
137 return SKIP;
138 else
139 goto no_match;
140 }
141 }
142#endif
143#ifdef CONFIG_FEATURE_FIND_NEWER 137#ifdef CONFIG_FEATURE_FIND_NEWER
144 if (newer_mtime != 0) { 138 if (newer_mtime != 0) {
145 time_t file_age = newer_mtime - statbuf->st_mtime; 139 time_t file_age = newer_mtime - statbuf->st_mtime;