From e64a11e9eb3544ebd91b4ed27543fc98122c773a Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 15 May 2011 17:00:43 +0000 Subject: [PATCH] sh: Avoid close(-1) when evaluating a multi-command pipeline. Valgrind complains about this. --- bin/sh/eval.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/sh/eval.c b/bin/sh/eval.c index b0ee28e7b0e7..b19c24f81a91 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -552,7 +552,8 @@ evalpipe(union node *n) if (prevfd >= 0) close(prevfd); prevfd = pip[0]; - close(pip[1]); + if (pip[1] != -1) + close(pip[1]); } INTON; if (n->npipe.backgnd == 0) {