svn commit: r221970 - head/bin/sh

Jilles Tjoelker jilles at FreeBSD.org
Sun May 15 17:00:44 UTC 2011


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) {


More information about the svn-src-head mailing list