Module Name: src
Committed By: christos
Date: Sun Jan 17 15:30:23 UTC 2016
Modified Files:
src/usr.bin/make: job.c meta.c
Log Message:
Use FD_CLOEXEC (Tilman Sauerbeck)
To generate a diff of this commit:
cvs rdiff -u -r1.182 -r1.183 src/usr.bin/make/job.c
cvs rdiff -u -r1.41 -r1.42 src/usr.bin/make/meta.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.182 src/usr.bin/make/job.c:1.183
--- src/usr.bin/make/job.c:1.182 Fri Jan 8 19:55:17 2016
+++ src/usr.bin/make/job.c Sun Jan 17 10:30:23 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.182 2016/01/09 00:55:17 christos Exp $ */
+/* $NetBSD: job.c,v 1.183 2016/01/17 15:30:23 christos 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.182 2016/01/09 00:55:17 christos Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.183 2016/01/17 15:30:23 christos 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.182 2016/01/09 00:55:17 christos Exp $");
+__RCSID("$NetBSD: job.c,v 1.183 2016/01/17 15:30:23 christos Exp $");
#endif
#endif /* not lint */
#endif
@@ -412,8 +412,8 @@ JobCreatePipe(Job *job, int minfd)
}
/* Set close-on-exec flag for both */
- (void)fcntl(job->jobPipe[0], F_SETFD, 1);
- (void)fcntl(job->jobPipe[1], F_SETFD, 1);
+ (void)fcntl(job->jobPipe[0], F_SETFD, FD_CLOEXEC);
+ (void)fcntl(job->jobPipe[1], F_SETFD, FD_CLOEXEC);
/*
* We mark the input side of the pipe non-blocking; we poll(2) the
@@ -1582,7 +1582,7 @@ JobStart(GNode *gn, int flags)
if (job->cmdFILE == NULL) {
Punt("Could not fdopen %s", tfile);
}
- (void)fcntl(FILENO(job->cmdFILE), F_SETFD, 1);
+ (void)fcntl(FILENO(job->cmdFILE), F_SETFD, FD_CLOEXEC);
/*
* Send the commands to the command file, flush all its buffers then
* rewind and remove the thing.
@@ -2835,8 +2835,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);
+ (void)fcntl(jp_0, F_SETFD, FD_CLOEXEC);
+ (void)fcntl(jp_1, F_SETFD, FD_CLOEXEC);
return;
}
Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.41 src/usr.bin/make/meta.c:1.42
--- src/usr.bin/make/meta.c:1.41 Mon Nov 30 18:37:56 2015
+++ src/usr.bin/make/meta.c Sun Jan 17 10:30:23 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: meta.c,v 1.41 2015/11/30 23:37:56 sjg Exp $ */
+/* $NetBSD: meta.c,v 1.42 2016/01/17 15:30:23 christos Exp $ */
/*
* Implement 'meta' mode.
@@ -144,8 +144,8 @@ filemon_open(BuildMon *pbm)
err(1, "Could not set filemon file descriptor!");
}
/* we don't need these once we exec */
- (void)fcntl(pbm->mon_fd, F_SETFD, 1);
- (void)fcntl(pbm->filemon_fd, F_SETFD, 1);
+ (void)fcntl(pbm->mon_fd, F_SETFD, FD_CLOEXEC);
+ (void)fcntl(pbm->filemon_fd, F_SETFD, FD_CLOEXEC);
}
/*
@@ -1423,8 +1423,8 @@ meta_compat_start(void)
if (pipe(childPipe) < 0)
Punt("Cannot create pipe: %s", strerror(errno));
/* Set close-on-exec flag for both */
- (void)fcntl(childPipe[0], F_SETFD, 1);
- (void)fcntl(childPipe[1], F_SETFD, 1);
+ (void)fcntl(childPipe[0], F_SETFD, FD_CLOEXEC);
+ (void)fcntl(childPipe[1], F_SETFD, FD_CLOEXEC);
}
void