summaryrefslogtreecommitdiff
path: root/sys/src
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2022-10-30 04:34:44 +0000
committerMichael Forney <mforney@mforney.org>2022-10-30 04:34:44 +0000
commitc7e25f71b4b4705e2dde15ceb497e4091b121c7e (patch)
tree1bc9de494df1913c384c6c819ec806ac710991e8 /sys/src
parent64eaf7ba5bafbb3995cfb6f986dfd9a735f8ff81 (diff)
rc: make `flag f [+-]` clear status on success
Otherwise, the old status will be retained, which may be non-empty if it follows an if command whose branch wasn't taken. This is problematic for scripts using -e.
Diffstat (limited to 'sys/src')
-rw-r--r--sys/src/cmd/rc/simple.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/src/cmd/rc/simple.c b/sys/src/cmd/rc/simple.c
index 1f2162c39..6f4d38b6f 100644
--- a/sys/src/cmd/rc/simple.c
+++ b/sys/src/cmd/rc/simple.c
@@ -445,10 +445,12 @@ execflag(void)
if(strlen(letter)==1){
if(strcmp(val, "+")==0){
flag[(unsigned char)letter[0]] = flagset;
+ setstatus("");
break;
}
if(strcmp(val, "-")==0){
flag[(unsigned char)letter[0]] = 0;
+ setstatus("");
break;
}
}