Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 May 2011 17:00:43 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r221970 - head/bin/sh
Message-ID:  <201105151700.p4FH0hHp045538@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sun May 15 17:00:43 2011
New Revision: 221970
URL: http://svn.freebsd.org/changeset/base/221970

Log:
  sh: Avoid close(-1) when evaluating a multi-command pipeline.
  
  Valgrind complains about this.

Modified:
  head/bin/sh/eval.c

Modified: head/bin/sh/eval.c
==============================================================================
--- head/bin/sh/eval.c	Sun May 15 16:40:42 2011	(r221969)
+++ head/bin/sh/eval.c	Sun May 15 17:00:43 2011	(r221970)
@@ -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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105151700.p4FH0hHp045538>