From 27921a1ba0e70a9f6c01f174d69749c689f625b5 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Wed, 26 Dec 2018 05:04:56 +0100 Subject: mk: fix closing random fd from uninitialized stack variable (thanks BurnZeZ, mycroftiv) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mycroftiv → this is practically "500 mile email" territory - the "6 letter mk bug" --- sys/src/cmd/mk/plan9.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sys/src') 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){ -- cgit v1.2.3