From 42ccfa71d81439ad8e8187e29db11dc9381097a4 Mon Sep 17 00:00:00 2001 From: Simon Schubert Date: Mon, 19 Jun 2006 12:05:43 +0000 Subject: [PATCH] Coverity CID 3384: Don't close -1. Coverity CID 2479: Clarify confusion about uninitialized variable in the presence of setjmp/vfork. Taken from: NetBSD via Coverity Prevent Submitted by: Gary --- bin/sh/eval.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/sh/eval.c b/bin/sh/eval.c index 2ce6ab7953..cd6bf4c393 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -35,7 +35,7 @@ * * @(#)eval.c 8.9 (Berkeley) 6/8/95 * $FreeBSD: src/bin/sh/eval.c,v 1.27.2.5 2002/08/27 01:36:28 tjr Exp $ - * $DragonFly: src/bin/sh/eval.c,v 1.6 2006/06/05 15:55:13 dillon Exp $ + * $DragonFly: src/bin/sh/eval.c,v 1.7 2006/06/19 12:05:43 corecode Exp $ */ #include /* For WIFSIGNALED(status) */ @@ -470,7 +470,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)); } } @@ -582,7 +583,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd) struct cmdentry cmdentry; struct job *jp; struct jmploc jmploc; - struct jmploc *volatile savehandler; + struct jmploc *volatile savehandler = NULL; const char *volatile savecmdname; volatile struct shparam saveparam; struct localvar *volatile savelocalvars; -- 2.41.0