From d23796a84a11d9bba0723c63e0c131d94ffdfd7d Mon Sep 17 00:00:00 2001 From: Peter Avalos Date: Mon, 4 Jul 2011 17:30:11 -1000 Subject: [PATCH] sh: Avoid close(-1) when evaluating a multi-command pipeline. Obtained-from: FreeBSD SVN rev 221970 --- bin/sh/eval.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/sh/eval.c b/bin/sh/eval.c index 8169d12860..f8f7d981b6 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)eval.c 8.9 (Berkeley) 6/8/95 - * $FreeBSD: src/bin/sh/eval.c,v 1.103 2011/04/25 20:54:12 jilles Exp $ + * $FreeBSD: src/bin/sh/eval.c,v 1.104 2011/05/15 17:00:43 jilles Exp $ */ #include @@ -554,7 +554,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) { -- 2.41.0