summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sysif.c1
-rw-r--r--tests/018/chmod.tl1
2 files changed, 2 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 */
diff --git a/tests/018/chmod.tl b/tests/018/chmod.tl
index 93739c48..8cde28eb 100644
--- a/tests/018/chmod.tl
+++ b/tests/018/chmod.tl
@@ -46,3 +46,4 @@
(cht "-----x------" "=,a+X" "------------")
(cht "-----x------" "a-x+X" "------------")
(cht "------------" "u+x-X" "------------")
+(cht "------------" "o+x=o" "-----------x")