diff options
author | Ollivier Robert <roberto@FreeBSD.org> | 2000-06-12 10:36:52 +0000 |
---|---|---|
committer | Ollivier Robert <roberto@FreeBSD.org> | 2000-06-12 10:36:52 +0000 |
commit | 9d2796c3ec23da6ad4c7ae91fc03125b467c9869 (patch) | |
tree | dd6d749cc82365b06793d9b0597c5741a1ad66e9 /usr.bin/find | |
parent | caea99a368d4755e2766715b01971a83b996e018 (diff) | |
download | src-9d2796c3ec23da6ad4c7ae91fc03125b467c9869.tar.gz src-9d2796c3ec23da6ad4c7ae91fc03125b467c9869.zip |
The find -perm option currently supports an exact match,
or if the mode is preceded by a '-', it checks for a match
in at least the bits specified on the command line. It is
often desirable to find things with any execute or setuid or
setgid bits set.
PR: bin/10169
Submitted by: Monte Mitzelfelt <monte@gonefishing.org>
Notes
Notes:
svn path=/head/; revision=61573
Diffstat (limited to 'usr.bin/find')
-rw-r--r-- | usr.bin/find/find.1 | 4 | ||||
-rw-r--r-- | usr.bin/find/find.h | 1 | ||||
-rw-r--r-- | usr.bin/find/function.c | 5 |
3 files changed, 9 insertions, 1 deletions
diff --git a/usr.bin/find/find.1 b/usr.bin/find/find.1 index d605e1986cac..cd51df3ac841 100644 --- a/usr.bin/find/find.1 +++ b/usr.bin/find/find.1 @@ -324,7 +324,9 @@ of the file's mode bits participate in the comparison. If the mode is preceded by a dash (``\-''), this primary evaluates to true if at least all of the bits in the mode are set in the file's mode bits. -If the mode is not preceded by a dash, this primary evaluates to true if +If the mode is preceded by a plus (``\+''), this primary evaluates to true +if any of the bits in the mode are set in the file's mode bits. +Otherwise, this primary evaluates to true if the bits in the mode exactly match the file's mode bits. Note, the first character of a symbolic mode may not be a dash (``\-''). .It Ic -flags Op Fl Ns Ar flags diff --git a/usr.bin/find/find.h b/usr.bin/find/find.h index b6e2eab86b6d..36a9193346e2 100644 --- a/usr.bin/find/find.h +++ b/usr.bin/find/find.h @@ -61,6 +61,7 @@ typedef struct _plandata { #define F_MTFLAG 1 /* fstype */ #define F_MTTYPE 2 #define F_ATLEAST 1 /* perm */ +#define F_ANY 2 /* perm */ int flags; /* private flags */ enum ntype type; /* plan node type */ union { diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c index 0dad26bb491c..b53f182c53ce 100644 --- a/usr.bin/find/function.c +++ b/usr.bin/find/function.c @@ -926,6 +926,8 @@ f_perm(plan, entry) (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO); if (plan->flags == F_ATLEAST) return ((plan->m_data | mode) == mode); + else if (plan->flags == F_ANY ) + return (plan->m_data & mode); else return (mode == plan->m_data); /* NOTREACHED */ @@ -945,6 +947,9 @@ c_perm(perm) if (*perm == '-') { new->flags = F_ATLEAST; ++perm; + } else if (*perm == '+') { + new->flags = F_ANY; + ++perm; } if ((set = setmode(perm)) == NULL) |