chmod: Implement X perm symbol
Instead of clearing the format bits before calling parsemode, leave them in so we can differentiate between directories and other files, then clear the format bits in the result.
This commit is contained in:
@@ -113,6 +113,10 @@ next:
|
||||
case 'x':
|
||||
perm |= S_IXUSR|S_IXGRP|S_IXOTH;
|
||||
break;
|
||||
case 'X':
|
||||
if (S_ISDIR(mode) || mode & (S_IXUSR|S_IXGRP|S_IXOTH))
|
||||
perm |= S_IXUSR|S_IXGRP|S_IXOTH;
|
||||
break;
|
||||
case 's':
|
||||
perm |= S_ISUID|S_ISGID;
|
||||
break;
|
||||
@@ -144,5 +148,5 @@ apply:
|
||||
goto next;
|
||||
}
|
||||
}
|
||||
return mode;
|
||||
return mode & ~S_IFMT;
|
||||
}
|
||||
|
Reference in New Issue
Block a user