summaryrefslogtreecommitdiffstats
path: root/bin/sh
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2013-06-28 21:47:08 +0000
committerjilles <jilles@FreeBSD.org>2013-06-28 21:47:08 +0000
commit836c13641c73319eef10a3a90e025e071f1a5c44 (patch)
tree4528fdaf16d13f5457602fa275c21cc78f70472a /bin/sh
parent26a7b2145683f1541b5d69ff0f4bf4c68574c6e8 (diff)
downloadFreeBSD-src-836c13641c73319eef10a3a90e025e071f1a5c44.zip
FreeBSD-src-836c13641c73319eef10a3a90e025e071f1a5c44.tar.gz
sh: Do not close(-1) if pipe() fails.
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/eval.c3
1 files changed, 2 insertions, 1 deletions
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));
}
}
OpenPOWER on IntegriCloud