summaryrefslogtreecommitdiff
path: root/sys/src
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2018-12-26 05:04:56 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2018-12-26 05:04:56 +0100
commit27921a1ba0e70a9f6c01f174d69749c689f625b5 (patch)
treee4c30c25ee83f4da2ed12a3235a0fccfe50de345 /sys/src
parent1b619dea42e60be0316f03a358c52c2e86a6d654 (diff)
mk: fix closing random fd from uninitialized stack variable (thanks BurnZeZ, mycroftiv)
mycroftiv → this is practically "500 mile email" territory - the "6 letter mk bug"
Diffstat (limited to 'sys/src')
-rw-r--r--sys/src/cmd/mk/plan9.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/src/cmd/mk/plan9.c b/sys/src/cmd/mk/plan9.c
index d87fcfa4d..485537c84 100644
--- a/sys/src/cmd/mk/plan9.c
+++ b/sys/src/cmd/mk/plan9.c
@@ -199,7 +199,8 @@ execsh(char *args, char *cmd, Bufblock *buf, Envy *e)
perror(shell);
_exits("exec");
}
- close(out[1]);
+ if(buf)
+ close(out[1]);
close(in[0]);
p = cmd+strlen(cmd);
while(cmd < p){