From 836c13641c73319eef10a3a90e025e071f1a5c44 Mon Sep 17 00:00:00 2001 From: jilles Date: Fri, 28 Jun 2013 21:47:08 +0000 Subject: sh: Do not close(-1) if pipe() fails. --- bin/sh/eval.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/sh/eval.c b/bin/sh/eval.c index d3708b3..1a6d5ed 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -589,7 +589,8 @@ evalpipe(union node *n) pip[1] = -1; if (lp->next) { if (pipe(pip) < 0) { - close(prevfd); + if (prevfd >= 0) + close(prevfd); error("Pipe call failed: %s", strerror(errno)); } } -- cgit v1.1