svn commit: r251422 - in head: contrib/bmake usr.bin/bmake

Simon J. Gerraty sjg at FreeBSD.org
Wed Jun 5 16:12:52 UTC 2013


Author: sjg
Date: Wed Jun  5 16:12:50 2013
New Revision: 251422
URL: http://svnweb.freebsd.org/changeset/base/251422

Log:
  Update to bmake-20130604 to fix file descriptor leak.

Modified:
  head/contrib/bmake/ChangeLog
  head/contrib/bmake/Makefile
  head/contrib/bmake/job.c
  head/contrib/bmake/make.1
  head/contrib/bmake/var.c
  head/usr.bin/bmake/Makefile
Directory Properties:
  head/contrib/bmake/   (props changed)

Modified: head/contrib/bmake/ChangeLog
==============================================================================
--- head/contrib/bmake/ChangeLog	Wed Jun  5 15:52:24 2013	(r251421)
+++ head/contrib/bmake/ChangeLog	Wed Jun  5 16:12:50 2013	(r251422)
@@ -1,3 +1,16 @@
+2013-06-04  Simon J. Gerraty  <sjg at bad.crufty.net>
+
+	* Makefile (MAKE_VERSION): 20130604
+	  Merge with NetBSD make, pick up
+	  o job.c: JobCreatePipe: do fcntl() after any tweaking of fd's
+	    to avoid leaking descriptors.
+
+2013-05-28  Simon J. Gerraty  <sjg at bad.crufty.net>
+
+	* Makefile (MAKE_VERSION): 20130528
+	  Merge with NetBSD make, pick up
+	  o var.c: cleanup some left-overs in VarHash()
+
 2013-05-20  Simon J. Gerraty  <sjg at bad.crufty.net>
 
 	* Makefile (MAKE_VERSION): 20130520

Modified: head/contrib/bmake/Makefile
==============================================================================
--- head/contrib/bmake/Makefile	Wed Jun  5 15:52:24 2013	(r251421)
+++ head/contrib/bmake/Makefile	Wed Jun  5 16:12:50 2013	(r251422)
@@ -1,7 +1,7 @@
-#	$Id: Makefile,v 1.12 2013/05/20 16:05:10 sjg Exp $
+#	$Id: Makefile,v 1.14 2013/06/05 04:03:22 sjg Exp $
 
 # Base version on src date
-MAKE_VERSION= 20130520
+MAKE_VERSION= 20130604
 
 PROG=	bmake
 

Modified: head/contrib/bmake/job.c
==============================================================================
--- head/contrib/bmake/job.c	Wed Jun  5 15:52:24 2013	(r251421)
+++ head/contrib/bmake/job.c	Wed Jun  5 16:12:50 2013	(r251422)
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.172 2013/03/05 22:01:43 christos Exp $	*/
+/*	$NetBSD: job.c,v 1.173 2013/06/05 03:59:43 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.172 2013/03/05 22:01:43 christos Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.173 2013/06/05 03:59:43 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)job.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: job.c,v 1.172 2013/03/05 22:01:43 christos Exp $");
+__RCSID("$NetBSD: job.c,v 1.173 2013/06/05 03:59:43 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -414,6 +414,15 @@ JobCreatePipe(Job *job, int minfd)
     if (pipe(job->jobPipe) == -1)
 	Punt("Cannot create pipe: %s", strerror(errno));
 
+    for (i = 0; i < 2; i++) {
+       /* Avoid using low numbered fds */
+       fd = fcntl(job->jobPipe[i], F_DUPFD, minfd);
+       if (fd != -1) {
+	   close(job->jobPipe[i]);
+	   job->jobPipe[i] = fd;
+       }
+    }
+    
     /* Set close-on-exec flag for both */
     (void)fcntl(job->jobPipe[0], F_SETFD, 1);
     (void)fcntl(job->jobPipe[1], F_SETFD, 1);
@@ -426,15 +435,6 @@ JobCreatePipe(Job *job, int minfd)
      */
     fcntl(job->jobPipe[0], F_SETFL, 
 	fcntl(job->jobPipe[0], F_GETFL, 0) | O_NONBLOCK);
-
-    for (i = 0; i < 2; i++) {
-       /* Avoid using low numbered fds */
-       fd = fcntl(job->jobPipe[i], F_DUPFD, minfd);
-       if (fd != -1) {
-	   close(job->jobPipe[i]);
-	   job->jobPipe[i] = fd;
-       }
-    }
 }
 
 /*-
@@ -2828,6 +2828,8 @@ Job_ServerStart(int max_tokens, int jp_0
 	/* Pipe passed in from parent */
 	tokenWaitJob.inPipe = jp_0;
 	tokenWaitJob.outPipe = jp_1;
+	(void)fcntl(jp_0, F_SETFD, 1);
+	(void)fcntl(jp_1, F_SETFD, 1);
 	return;
     }
 

Modified: head/contrib/bmake/make.1
==============================================================================
--- head/contrib/bmake/make.1	Wed Jun  5 15:52:24 2013	(r251421)
+++ head/contrib/bmake/make.1	Wed Jun  5 16:12:50 2013	(r251422)
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.213 2013/03/31 05:49:51 sjg Exp $
+.\"	$NetBSD: make.1,v 1.215 2013/05/22 19:35:11 christos Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	from: @(#)make.1	8.4 (Berkeley) 3/19/94
 .\"
-.Dd March 30, 2013
+.Dd May 22, 2013
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -2110,6 +2110,13 @@ for Sprite at Berkeley.
 It was designed to be a parallel distributed make running jobs on different
 machines using a daemon called
 .Dq customs .
+.Pp
+Historically the target/dependency
+.Dq FRC
+has been used to FoRCe rebuilding (since the target/dependency
+does not exist... unless someone creates an 
+.Dq FRC
+file).
 .Sh BUGS
 The
 .Nm

Modified: head/contrib/bmake/var.c
==============================================================================
--- head/contrib/bmake/var.c	Wed Jun  5 15:52:24 2013	(r251421)
+++ head/contrib/bmake/var.c	Wed Jun  5 16:12:50 2013	(r251422)
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $	*/
+/*	$NetBSD: var.c,v 1.175 2013/05/29 00:23:31 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.175 2013/05/29 00:23:31 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $");
+__RCSID("$NetBSD: var.c,v 1.175 2013/05/29 00:23:31 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2326,9 +2326,7 @@ VarHash(char *str)
     size_t         len, len2;
     unsigned char  *ustr = (unsigned char *)str;
     uint32_t       h, k, c1, c2;
-    int            done;
 
-    done = 1;
     h  = 0x971e137bU;
     c1 = 0x95543787U;
     c2 = 0x2ad7eb25U;
@@ -2358,7 +2356,7 @@ VarHash(char *str)
 	h = (h << 13) ^ (h >> 19);
 	h = h * 5 + 0x52dce729U;
 	h ^= k;
-   } while (!done);
+   }
    h ^= len2;
    h *= 0x85ebca6b;
    h ^= h >> 13;

Modified: head/usr.bin/bmake/Makefile
==============================================================================
--- head/usr.bin/bmake/Makefile	Wed Jun  5 15:52:24 2013	(r251421)
+++ head/usr.bin/bmake/Makefile	Wed Jun  5 16:12:50 2013	(r251422)
@@ -14,10 +14,10 @@ CFLAGS+= -I${.CURDIR}
 CLEANDIRS+= FreeBSD
 CLEANFILES+= bootstrap
 
-#	$Id: Makefile,v 1.12 2013/05/20 16:05:10 sjg Exp $
+#	$Id: Makefile,v 1.14 2013/06/05 04:03:22 sjg Exp $
 
 # Base version on src date
-MAKE_VERSION= 20130520
+MAKE_VERSION= 20130604
 
 PROG?=	${.CURDIR:T}
 


More information about the svn-src-all mailing list