summaryrefslogtreecommitdiff
path: root/devel/bmake
diff options
context:
space:
mode:
authorrillig <rillig>2007-03-16 00:51:12 +0000
committerrillig <rillig>2007-03-16 00:51:12 +0000
commiteee20438b637977dd8ea528e97b7e5b135902d77 (patch)
tree9676c6c1ceb3eff1317457808207ceae4b27c5ca /devel/bmake
parentf56def8c9e063383f9e3d480edd8e3f8caeb74dc (diff)
downloadpkgsrc-eee20438b637977dd8ea528e97b7e5b135902d77.tar.gz
Backed out the latest change (the "arg list too long" fix for IRIX). As
joerg has pointed out, after calling vfork() one can hardly do anything. A solution would be to simply not use vfork(), but that may have performance impacts on all platforms.
Diffstat (limited to 'devel/bmake')
-rw-r--r--devel/bmake/files/compat.c14
-rw-r--r--devel/bmake/files/job.c71
-rw-r--r--devel/bmake/files/job.h3
3 files changed, 14 insertions, 74 deletions
diff --git a/devel/bmake/files/compat.c b/devel/bmake/files/compat.c
index 3d7d792bd3a..adfdcf09a89 100644
--- a/devel/bmake/files/compat.c
+++ b/devel/bmake/files/compat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: compat.c,v 1.2 2007/03/15 09:41:22 rillig Exp $ */
+/* $NetBSD: compat.c,v 1.3 2007/03/16 00:51:12 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.2 2007/03/15 09:41:22 rillig Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.3 2007/03/16 00:51:12 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: compat.c,v 1.2 2007/03/15 09:41:22 rillig Exp $");
+__RCSID("$NetBSD: compat.c,v 1.3 2007/03/16 00:51:12 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -220,6 +220,8 @@ CompatRunCommand(ClientData cmdp, ClientData gnp)
const char **av; /* Argument vector for thing to exec */
int argc; /* Number of arguments in av or 0 if not
* dynamically allocated */
+ Boolean local; /* TRUE if command should be executed
+ * locally */
char *cmd = (char *)cmdp;
GNode *gn = (GNode *)gnp;
@@ -337,6 +339,8 @@ CompatRunCommand(ClientData cmdp, ClientData gnp)
av = (const char **)brk_string(cmd, &argc, TRUE, &bp);
}
+ local = TRUE;
+
/*
* Fork and execute the single command. If the fork fails, we abort.
*/
@@ -346,10 +350,10 @@ CompatRunCommand(ClientData cmdp, ClientData gnp)
}
if (cpid == 0) {
Check_Cwd(av);
- if (*cp == '\0')
+ if (local)
(void)execvp(av[0], (char *const *)UNCONST(av));
else
- Job_Execv(av[0], (char **)UNCONST(av));
+ (void)execv(av[0], (char *const *)UNCONST(av));
execError("exec", av[0]);
_exit(1);
}
diff --git a/devel/bmake/files/job.c b/devel/bmake/files/job.c
index 66f1600769a..df52d874acb 100644
--- a/devel/bmake/files/job.c
+++ b/devel/bmake/files/job.c
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.3 2007/03/15 09:41:22 rillig Exp $ */
+/* $NetBSD: job.c,v 1.4 2007/03/16 00:51:12 rillig 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.3 2007/03/15 09:41:22 rillig Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.4 2007/03/16 00:51:12 rillig 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.3 2007/03/15 09:41:22 rillig Exp $");
+__RCSID("$NetBSD: job.c,v 1.4 2007/03/16 00:51:12 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -136,8 +136,6 @@ __RCSID("$NetBSD: job.c,v 1.3 2007/03/15 09:41:22 rillig Exp $");
* Job_Touch Update a target without really updating it.
*
* Job_Wait Wait for all currently-running jobs to finish.
- *
- * Job_Execv Execute a shell job.
*/
#ifdef HAVE_CONFIG_H
@@ -1569,7 +1567,7 @@ JobExec(Job *job, char **argv)
} else
#endif /* REMOTE */
{
- Job_Execv(shellPath, argv);
+ (void)execv(shellPath, argv);
execError("exec", shellPath);
}
_exit(1);
@@ -3755,64 +3753,3 @@ emul_poll(struct pollfd *fd, int nfd, int timeout)
return npoll;
}
#endif /* USE_SELECT */
-
-/*-
- *-----------------------------------------------------------------------
- * Job_Execv --
- * execute a shell job.
- *
- * Results:
- * Executes a shell with the given arguments. If the command is too
- * long, writes it into a temporary file and executes that.
- *
- * Does not return if the job could be executed.
- *
- * Side Effects:
- * May modify argv[].
- *
- *-----------------------------------------------------------------------
- */
-void Job_Execv(const char *argv0, char **argv)
-{
- FILE *tfile;
- char cmd[2 + sizeof(TMPPAT)]; /* ". /tmpname" */
- size_t len;
- int argc, tfd;
- char *tmpfname;
-
- /* Try to execute the command. */
- (void)execv(argv0, argv);
- if (errno != E2BIG)
- return;
-
- /*
- * The command line is too long, so save it into a temporary
- * file and run the shell with that file.
- */
-
- /* Assume that the last argument is the shell command. */
- argc = 0;
- while (argv[argc])
- argc++;
-
- (void)strcpy(cmd, ". ");
- (void)strcat(cmd, TMPPAT);
- tmpfname = cmd + 2;
-
- if ((tfd = mkstemp(tmpfname)) == -1)
- Punt("Could not create temporary file %s: %s", tmpfname, strerror(errno));
-
- tfile = fdopen(tfd, "w");
- if (tfile == NULL)
- Punt("fdopen: %s", strerror(errno));
-
- len = strlen(argv[argc - 1]);
- if (fwrite(argv[argc - 1], 1, len, tfile) != len
- || fputc('\n', tfile) == EOF
- || fclose(tfile) != 0)
- Punt("Could not write to %s: %s", tmpfname, strerror(errno));
- argv[argc - 1] = cmd;
-
- /* Now try again. */
- (void)execv(argv0, argv);
-}
diff --git a/devel/bmake/files/job.h b/devel/bmake/files/job.h
index 499731ddbb2..cbed44d50f5 100644
--- a/devel/bmake/files/job.h
+++ b/devel/bmake/files/job.h
@@ -1,4 +1,4 @@
-/* $NetBSD: job.h,v 1.2 2007/03/15 09:41:22 rillig Exp $ */
+/* $NetBSD: job.h,v 1.3 2007/03/16 00:51:12 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -313,6 +313,5 @@ void Job_TokenReturn(void);
void Job_TokenFlush(void);
Boolean Job_TokenWithdraw(void);
void Job_ServerStart(int);
-void Job_Execv(const char *, char **);
#endif /* _JOB_H_ */