summaryrefslogtreecommitdiffstats
path: root/sysif.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-02-08 08:47:44 -0800
committerKaz Kylheku <kaz@kylheku.com>2020-02-08 08:47:44 -0800
commitd201dc097fa6920b37c16dd83ca7e52575223d2f (patch)
tree1fbef878311b1c1a8355563d9cea4461a6e1f150 /sysif.c
parentb8a5b08de163e80e1b72459c5c889bb70eef947b (diff)
downloadtxr-d201dc097fa6920b37c16dd83ca7e52575223d2f.tar.gz
txr-d201dc097fa6920b37c16dd83ca7e52575223d2f.tar.bz2
txr-d201dc097fa6920b37c16dd83ca7e52575223d2f.zip
chmod: ugo perms sees effects from same clause.
This is Coreutils chmod behavior. * sysif.c (chmod_wrap): Sample cmode into oldm at the start of every assigment before punching the masked hole into cmode. * tests/018/chmod.tl: Breaking test case added.
Diffstat (limited to 'sysif.c')
-rw-r--r--sysif.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sysif.c b/sysif.c
index 444f8326..638f9642 100644
--- a/sysif.c
+++ b/sysif.c
@@ -673,6 +673,7 @@ static val chmod_wrap(val target, val mode)
case chm_sub: cmode &= ~bits; break;
case chm_set:
if (cs == chm_perm) {
+ oldm = cmode;
cmode &= ~mask;
if (implicit_all || (who & CHM_O) != 0)
cmode &= ~S_ISVTX; /* GNU Coreutils 8.28 chmod behavior */