aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2014-09-05 12:16:15 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2014-09-05 12:16:15 +0200
commit3e9b13e4c572d97468bef029f9c6e72271297fcb (patch)
tree5169484c6f9bef9666ab3019a2d3632865698685
parent4eb1e425fec4cf0eecd3fd33dc838f9332af5e44 (diff)
downloadbusybox-w32-3e9b13e4c572d97468bef029f9c6e72271297fcb.tar.gz
busybox-w32-3e9b13e4c572d97468bef029f9c6e72271297fcb.tar.bz2
busybox-w32-3e9b13e4c572d97468bef029f9c6e72271297fcb.zip
find: support -perm /BITS. Closes 7340
function old new delta parse_params 1487 1497 +10 func_perm 57 61 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 14/0) Total: 14 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--findutils/find.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/findutils/find.c b/findutils/find.c
index 56a7ed3ab..83aa63f92 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -558,8 +558,8 @@ ACTF(type)
558#if ENABLE_FEATURE_FIND_PERM 558#if ENABLE_FEATURE_FIND_PERM
559ACTF(perm) 559ACTF(perm)
560{ 560{
561 /* -perm +mode: at least one of perm_mask bits are set */ 561 /* -perm [+/]mode: at least one of perm_mask bits are set */
562 if (ap->perm_char == '+') 562 if (ap->perm_char == '+' || ap->perm_char == '/')
563 return (statbuf->st_mode & ap->perm_mask) != 0; 563 return (statbuf->st_mode & ap->perm_mask) != 0;
564 /* -perm -mode: all of perm_mask are set */ 564 /* -perm -mode: all of perm_mask are set */
565 if (ap->perm_char == '-') 565 if (ap->perm_char == '-')
@@ -1252,14 +1252,14 @@ static action*** parse_params(char **argv)
1252/* -perm BITS File's mode bits are exactly BITS (octal or symbolic). 1252/* -perm BITS File's mode bits are exactly BITS (octal or symbolic).
1253 * Symbolic modes use mode 0 as a point of departure. 1253 * Symbolic modes use mode 0 as a point of departure.
1254 * -perm -BITS All of the BITS are set in file's mode. 1254 * -perm -BITS All of the BITS are set in file's mode.
1255 * -perm +BITS At least one of the BITS is set in file's mode. 1255 * -perm [+/]BITS At least one of the BITS is set in file's mode.
1256 */ 1256 */
1257 else if (parm == PARM_perm) { 1257 else if (parm == PARM_perm) {
1258 action_perm *ap; 1258 action_perm *ap;
1259 dbg("%d", __LINE__); 1259 dbg("%d", __LINE__);
1260 ap = ALLOC_ACTION(perm); 1260 ap = ALLOC_ACTION(perm);
1261 ap->perm_char = arg1[0]; 1261 ap->perm_char = arg1[0];
1262 arg1 = plus_minus_num(arg1); 1262 arg1 = (arg1[0] == '/' ? arg1+1 : plus_minus_num(arg1));
1263 /*ap->perm_mask = 0; - ALLOC_ACTION did it */ 1263 /*ap->perm_mask = 0; - ALLOC_ACTION did it */
1264 if (!bb_parse_mode(arg1, &ap->perm_mask)) 1264 if (!bb_parse_mode(arg1, &ap->perm_mask))
1265 bb_error_msg_and_die("invalid mode '%s'", arg1); 1265 bb_error_msg_and_die("invalid mode '%s'", arg1);