summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsjg <sjg@FreeBSD.org>2013-06-05 16:12:50 +0000
committersjg <sjg@FreeBSD.org>2013-06-05 16:12:50 +0000
commit5d26938b1d35cf753994309c70a0ef31b8302288 (patch)
tree789e70a5bdc53ba9877c05494da4c8f48c6b0b2c
parentad8f1288616c7cfbc352251ce284661623f69fb8 (diff)
downloadFreeBSD-src-5d26938b1d35cf753994309c70a0ef31b8302288.zip
FreeBSD-src-5d26938b1d35cf753994309c70a0ef31b8302288.tar.gz
Update to bmake-20130604 to fix file descriptor leak.
-rw-r--r--contrib/bmake/ChangeLog13
-rw-r--r--contrib/bmake/Makefile4
-rw-r--r--contrib/bmake/job.c26
-rw-r--r--contrib/bmake/make.111
-rw-r--r--contrib/bmake/var.c10
-rw-r--r--usr.bin/bmake/Makefile4
6 files changed, 44 insertions, 24 deletions
diff --git a/contrib/bmake/ChangeLog b/contrib/bmake/ChangeLog
index 0af20ca..587c7f9 100644
--- a/contrib/bmake/ChangeLog
+++ b/contrib/bmake/ChangeLog
@@ -1,3 +1,16 @@
+2013-06-04 Simon J. Gerraty <sjg@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@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@bad.crufty.net>
* Makefile (MAKE_VERSION): 20130520
diff --git a/contrib/bmake/Makefile b/contrib/bmake/Makefile
index 084142a..c4bcfa4 100644
--- a/contrib/bmake/Makefile
+++ b/contrib/bmake/Makefile
@@ -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
diff --git a/contrib/bmake/job.c b/contrib/bmake/job.c
index a77eaab..a0e407c 100644
--- a/contrib/bmake/job.c
+++ b/contrib/bmake/job.c
@@ -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, int jp_1)
/* 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;
}
diff --git a/contrib/bmake/make.1 b/contrib/bmake/make.1
index 8c38682..a2cc16a 100644
--- a/contrib/bmake/make.1
+++ b/contrib/bmake/make.1
@@ -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
diff --git a/contrib/bmake/var.c b/contrib/bmake/var.c
index f09862a..8ad0a4e 100644
--- a/contrib/bmake/var.c
+++ b/contrib/bmake/var.c
@@ -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;
diff --git a/usr.bin/bmake/Makefile b/usr.bin/bmake/Makefile
index c49daa7..0765106 100644
--- a/usr.bin/bmake/Makefile
+++ b/usr.bin/bmake/Makefile
@@ -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}
OpenPOWER on IntegriCloud