summaryrefslogtreecommitdiffstats
path: root/parse.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2021-01-13 09:35:45 -0500
committerTavian Barnes <tavianator@tavianator.com>2021-01-13 09:38:05 -0500
commit6cd1b2d427a8c7e487d40d371435a2b30cf94ba3 (patch)
tree6d62bffbb7f5bcf79ddd32953ce975ab4f7c4abc /parse.c
parent6e29563b1bf41b317ea69da35c7b1e64e7f0d5e0 (diff)
downloadbfs-6cd1b2d427a8c7e487d40d371435a2b30cf94ba3.tar.xz
-perm: Use +t instead of ug+t
The chmod spec says that ug+t is unspecified, and only +t or a+t is guaranteed to actually set the sticky bit. In practice GNU tools respect o+t as well, but ignore u+t/g+t. Fix the implementation to match GNU, and only test the POSIX required parse.
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/parse.c b/parse.c
index 4e326ec..fa95e69 100644
--- a/parse.c
+++ b/parse.c
@@ -1896,8 +1896,10 @@ static int parse_mode(const struct parser_state *state, const char *mode, struct
}
break;
case 't':
- file_change |= S_ISVTX;
- dir_change |= S_ISVTX;
+ if (who & 0007) {
+ file_change |= S_ISVTX;
+ dir_change |= S_ISVTX;
+ }
break;
default:
mstate = MODE_ACTION_APPLY;