diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c index dc3cd32d457f..fb3075355f1f 100644 --- a/usr.bin/make/compat.c +++ b/usr.bin/make/compat.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.40 2002/02/07 16:48:22 pk Exp $ */ +/* $NetBSD: compat.c,v 1.41 2002/03/14 16:08:37 pk Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -39,14 +39,14 @@ */ #ifdef MAKE_BOOTSTRAP -static char rcsid[] = "$NetBSD: compat.c,v 1.40 2002/02/07 16:48:22 pk Exp $"; +static char rcsid[] = "$NetBSD: compat.c,v 1.41 2002/03/14 16:08:37 pk Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: compat.c,v 1.40 2002/02/07 16:48:22 pk Exp $"); +__RCSID("$NetBSD: compat.c,v 1.41 2002/03/14 16:08:37 pk Exp $"); #endif #endif /* not lint */ #endif @@ -289,7 +289,7 @@ CompatRunCommand (cmdp, gnp) (void)execvp(av[0], av); else (void)execv(av[0], av); - execError(av[0]); + execError("exec", av[0]); _exit(1); } if (bp) { diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index 148446c43291..d7e55da727b1 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.63 2002/03/14 08:07:55 pk Exp $ */ +/* $NetBSD: job.c,v 1.64 2002/03/14 16:08:38 pk Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -39,14 +39,14 @@ */ #ifdef MAKE_BOOTSTRAP -static char rcsid[] = "$NetBSD: job.c,v 1.63 2002/03/14 08:07:55 pk Exp $"; +static char rcsid[] = "$NetBSD: job.c,v 1.64 2002/03/14 16:08:38 pk Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: job.c,v 1.63 2002/03/14 08:07:55 pk Exp $"); +__RCSID("$NetBSD: job.c,v 1.64 2002/03/14 16:08:38 pk Exp $"); #endif #endif /* not lint */ #endif @@ -1329,8 +1329,10 @@ JobExec(job, argv) * reset it to the beginning (again). Since the stream was marked * close-on-exec, we must clear that bit in the new input. */ - if (dup2(FILENO(job->cmdFILE), 0) == -1) - Punt("Cannot dup2: %s", strerror(errno)); + if (dup2(FILENO(job->cmdFILE), 0) == -1) { + execError("dup2", "job->cmdFILE"); + _exit(1); + } (void) fcntl(0, F_SETFD, 0); (void) lseek(0, (off_t)0, SEEK_SET); @@ -1347,16 +1349,20 @@ JobExec(job, argv) * Set up the child's output to be routed through the pipe * we've created for it. */ - if (dup2(job->outPipe, 1) == -1) - Punt("Cannot dup2: %s", strerror(errno)); + if (dup2(job->outPipe, 1) == -1) { + execError("dup2", "job->outPipe"); + _exit(1); + } } else { /* * We're capturing output in a file, so we duplicate the * descriptor to the temporary file into the standard * output. */ - if (dup2(job->outFd, 1) == -1) - Punt("Cannot dup2: %s", strerror(errno)); + if (dup2(job->outFd, 1) == -1) { + execError("dup2", "job->outFd"); + _exit(1); + } } /* * The output channels are marked close on exec. This bit was @@ -1365,8 +1371,10 @@ JobExec(job, argv) * its standard output. */ (void) fcntl(1, F_SETFD, 0); - if (dup2(1, 2) == -1) - Punt("Cannot dup2: %s", strerror(errno)); + if (dup2(1, 2) == -1) { + execError("dup2", "1, 2"); + _exit(1); + } #ifdef USE_PGRP /* @@ -1388,7 +1396,7 @@ JobExec(job, argv) #endif /* REMOTE */ { (void) execv(shellPath, argv); - execError(shellPath); + execError("exec", shellPath); } _exit(1); } else { diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 7c1ee185450d..9d2007f7124e 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.82 2002/01/27 01:50:54 reinoud Exp $ */ +/* $NetBSD: main.c,v 1.83 2002/03/14 16:08:39 pk Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -39,7 +39,7 @@ */ #ifdef MAKE_BOOTSTRAP -static char rcsid[] = "$NetBSD: main.c,v 1.82 2002/01/27 01:50:54 reinoud Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.83 2002/03/14 16:08:39 pk Exp $"; #else #include #ifndef lint @@ -51,7 +51,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\n\ #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: main.c,v 1.82 2002/01/27 01:50:54 reinoud Exp $"); +__RCSID("$NetBSD: main.c,v 1.83 2002/03/14 16:08:39 pk Exp $"); #endif #endif /* not lint */ #endif @@ -1576,12 +1576,13 @@ eunlink(file) * Print why exec failed, avoiding stdio. */ void -execError(av) +execError(af, av) + const char *af; const char *av; { #ifdef USE_IOVEC int i = 0; - struct iovec iov[6]; + struct iovec iov[8]; #define IOADD(s) \ (void)(iov[i].iov_base = (s), \ iov[i].iov_len = strlen(iov[i].iov_base), \ @@ -1591,14 +1592,16 @@ execError(av) #endif IOADD(progname); - IOADD(": Exec of `"); + IOADD(": "); + IOADD((char *)af); + IOADD("("); IOADD((char *)av); - IOADD("' failed ("); + IOADD(") failed ("); IOADD(strerror(errno)); IOADD(")\n"); #ifdef USE_IOVEC - (void)writev(2, iov, 6); + (void)writev(2, iov, 8); #endif } diff --git a/usr.bin/make/nonints.h b/usr.bin/make/nonints.h index 9454da91dd3d..75a9aed3096c 100644 --- a/usr.bin/make/nonints.h +++ b/usr.bin/make/nonints.h @@ -1,4 +1,4 @@ -/* $NetBSD: nonints.h,v 1.25 2002/01/18 03:36:00 thorpej Exp $ */ +/* $NetBSD: nonints.h,v 1.26 2002/03/14 16:08:39 pk Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -88,7 +88,7 @@ void *emalloc __P((size_t)); void *erealloc __P((void *, size_t)); void enomem __P((void)); int eunlink __P((const char *)); -void execError __P((const char *)); +void execError __P((const char *, const char *)); /* parse.c */ void Parse_Error __P((int, char *, ...))