aboutsummaryrefslogtreecommitdiff
path: root/job.c
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2016-03-11 00:37:02 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2016-03-11 00:37:02 +0000
commitd58aa1959ce6eb99db9e15b1f59db03cfd79069b (patch)
tree3fccce67c0a1c2882f96019d55f172fb8c0976fd /job.c
parent6c770d664f0700039a4eaf3d79f672ffb99204b6 (diff)
downloadsrc-d58aa1959ce6eb99db9e15b1f59db03cfd79069b.tar.gz
src-d58aa1959ce6eb99db9e15b1f59db03cfd79069b.zip
Import bmake-20160307vendor/NetBSD/bmake/20160307
Notes
Notes: svn path=/vendor/NetBSD/bmake/dist/; revision=296635 svn path=/vendor/NetBSD/bmake/20160307/; revision=296636; tag=vendor/NetBSD/bmake/20160307
Diffstat (limited to 'job.c')
-rw-r--r--job.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/job.c b/job.c
index cc209e6c136f..93e7430bc667 100644
--- a/job.c
+++ b/job.c
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.181 2015/10/11 04:51:24 sjg Exp $ */
+/* $NetBSD: job.c,v 1.186 2016/02/18 18:29:14 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.181 2015/10/11 04:51:24 sjg Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.186 2016/02/18 18:29:14 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.181 2015/10/11 04:51:24 sjg Exp $");
+__RCSID("$NetBSD: job.c,v 1.186 2016/02/18 18:29:14 christos Exp $");
#endif
#endif /* not lint */
#endif
@@ -144,7 +144,6 @@ __RCSID("$NetBSD: job.c,v 1.181 2015/10/11 04:51:24 sjg Exp $");
#include <assert.h>
#include <errno.h>
-#include <fcntl.h>
#if !defined(USE_SELECT) && defined(HAVE_POLL_H)
#include <poll.h>
#else
@@ -425,8 +424,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
@@ -715,7 +714,7 @@ JobPrintCommand(void *cmdp, void *jobp)
numCommands += 1;
- cmdStart = cmd = Var_Subst(NULL, cmd, job->node, FALSE, TRUE);
+ cmdStart = cmd = Var_Subst(NULL, cmd, job->node, VARF_WANTRES);
cmdTemplate = "%s\n";
@@ -866,8 +865,7 @@ JobPrintCommand(void *cmdp, void *jobp)
DBPRINTF(cmdTemplate, cmd);
free(cmdStart);
- if (escCmd)
- free(escCmd);
+ free(escCmd);
if (errOff) {
/*
* If echoing is already off, there's no point in issuing the
@@ -903,7 +901,7 @@ JobPrintCommand(void *cmdp, void *jobp)
static int
JobSaveCommand(void *cmd, void *gn)
{
- cmd = Var_Subst(NULL, (char *)cmd, (GNode *)gn, FALSE, TRUE);
+ cmd = Var_Subst(NULL, (char *)cmd, (GNode *)gn, VARF_WANTRES);
(void)Lst_AtEnd(postCommands->commands, cmd);
return(0);
}
@@ -1234,8 +1232,7 @@ Job_CheckCommands(GNode *gn, void (*abortProc)(const char *, ...))
*/
Make_HandleUse(DEFAULT, gn);
Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), gn, 0);
- if (p1)
- free(p1);
+ free(p1);
} else if (Dir_MTime(gn, 0) == 0 && (gn->type & OP_SPECIAL) == 0) {
/*
* The node wasn't the target of an operator we have no .DEFAULT
@@ -1598,7 +1595,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.
@@ -2195,7 +2192,7 @@ Job_SetPrefix(void)
}
targPrefix = Var_Subst(NULL, "${" MAKE_JOB_PREFIX "}",
- VAR_GLOBAL, FALSE, TRUE);
+ VAR_GLOBAL, VARF_WANTRES);
}
/*-
@@ -2402,8 +2399,7 @@ Job_ParseShell(char *line)
line++;
}
- if (shellArgv)
- free(UNCONST(shellArgv));
+ free(UNCONST(shellArgv));
memset(&newShell, 0, sizeof(newShell));
@@ -2651,8 +2647,7 @@ void
Job_End(void)
{
#ifdef CLEANUP
- if (shellArgv)
- free(shellArgv);
+ free(shellArgv);
#endif
}
@@ -2851,8 +2846,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);
+ (void)fcntl(jp_0, F_SETFD, FD_CLOEXEC);
+ (void)fcntl(jp_1, F_SETFD, FD_CLOEXEC);
return;
}