|
|
71dafe |
diff -urp make-3.82/misc.c make-3.82-pm/misc.c
|
|
|
71dafe |
--- make-3.82/misc.c 2010-07-19 09:10:54.000000000 +0200
|
|
|
71dafe |
+++ make-3.82-pm/misc.c 2010-08-11 15:26:45.000000000 +0200
|
|
|
71dafe |
@@ -342,17 +342,31 @@ strerror (int errnum)
|
|
|
71dafe |
/* Print an error message from errno. */
|
|
|
71dafe |
|
|
|
71dafe |
void
|
|
|
71dafe |
+perror_with_name_err (const char *str, const char *name, int errnum)
|
|
|
71dafe |
+{
|
|
|
71dafe |
+ error (NILF, _("%s%s: %s"), str, name, strerror (errnum));
|
|
|
71dafe |
+}
|
|
|
71dafe |
+
|
|
|
71dafe |
+void
|
|
|
71dafe |
perror_with_name (const char *str, const char *name)
|
|
|
71dafe |
{
|
|
|
71dafe |
- error (NILF, _("%s%s: %s"), str, name, strerror (errno));
|
|
|
71dafe |
+ perror_with_name_err (str, name, errno);
|
|
|
71dafe |
}
|
|
|
71dafe |
|
|
|
71dafe |
/* Print an error message from errno and exit. */
|
|
|
71dafe |
|
|
|
71dafe |
void
|
|
|
71dafe |
+pfatal_with_name_err (const char *name, int errnum)
|
|
|
71dafe |
+{
|
|
|
71dafe |
+ fatal (NILF, _("%s: %s"), name, strerror (errnum));
|
|
|
71dafe |
+
|
|
|
71dafe |
+ /* NOTREACHED */
|
|
|
71dafe |
+}
|
|
|
71dafe |
+
|
|
|
71dafe |
+void
|
|
|
71dafe |
pfatal_with_name (const char *name)
|
|
|
71dafe |
{
|
|
|
71dafe |
- fatal (NILF, _("%s: %s"), name, strerror (errno));
|
|
|
71dafe |
+ pfatal_with_name_err (name, errno);
|
|
|
71dafe |
|
|
|
71dafe |
/* NOTREACHED */
|
|
|
71dafe |
}
|
|
|
71dafe |
diff -urp make-3.82/main.c make-3.82-pm/main.c
|
|
|
71dafe |
--- make-3.82/main.c 2010-08-11 15:34:12.000000000 +0200
|
|
|
71dafe |
+++ make-3.82-pm/main.c 2010-08-11 15:30:11.000000000 +0200
|
|
|
71dafe |
@@ -1536,13 +1536,13 @@ main (int argc, char **argv, char **envp
|
|
|
71dafe |
strcat (template, DEFAULT_TMPFILE);
|
|
|
71dafe |
outfile = open_tmpfile (&stdin_nm, template);
|
|
|
71dafe |
if (outfile == 0)
|
|
|
71dafe |
- pfatal_with_name (_("fopen (temporary file)"));
|
|
|
71dafe |
+ pfatal_with_name_err (_("fopen (temporary file)"), errno);
|
|
|
71dafe |
while (!feof (stdin) && ! ferror (stdin))
|
|
|
71dafe |
{
|
|
|
71dafe |
char buf[2048];
|
|
|
71dafe |
unsigned int n = fread (buf, 1, sizeof (buf), stdin);
|
|
|
71dafe |
if (n > 0 && fwrite (buf, 1, n, outfile) != n)
|
|
|
71dafe |
- pfatal_with_name (_("fwrite (temporary file)"));
|
|
|
71dafe |
+ pfatal_with_name_err (_("fwrite (temporary file)"), errno);
|
|
|
71dafe |
}
|
|
|
71dafe |
fclose (outfile);
|
|
|
71dafe |
|
|
|
71dafe |
@@ -1747,7 +1747,7 @@ main (int argc, char **argv, char **envp
|
|
|
71dafe |
else if ((job_rfd = dup (job_fds[0])) < 0)
|
|
|
71dafe |
{
|
|
|
71dafe |
if (errno != EBADF)
|
|
|
71dafe |
- pfatal_with_name (_("dup jobserver"));
|
|
|
71dafe |
+ pfatal_with_name_err (_("dup jobserver"), errno);
|
|
|
71dafe |
|
|
|
71dafe |
error (NILF,
|
|
|
71dafe |
_("warning: jobserver unavailable: using -j1. Add `+' to parent make rule."));
|
|
|
71dafe |
@@ -1788,7 +1788,7 @@ main (int argc, char **argv, char **envp
|
|
|
71dafe |
char c = '+';
|
|
|
71dafe |
|
|
|
71dafe |
if (pipe (job_fds) < 0 || (job_rfd = dup (job_fds[0])) < 0)
|
|
|
71dafe |
- pfatal_with_name (_("creating jobs pipe"));
|
|
|
71dafe |
+ pfatal_with_name_err (_("creating jobs pipe"), errno);
|
|
|
71dafe |
|
|
|
71dafe |
/* Every make assumes that it always has one job it can run. For the
|
|
|
71dafe |
submakes it's the token they were given by their parent. For the
|
|
|
71dafe |
@@ -1803,7 +1803,7 @@ main (int argc, char **argv, char **envp
|
|
|
71dafe |
|
|
|
71dafe |
EINTRLOOP (r, write (job_fds[1], &c, 1));
|
|
|
71dafe |
if (r != 1)
|
|
|
71dafe |
- pfatal_with_name (_("init jobserver pipe"));
|
|
|
71dafe |
+ pfatal_with_name_err (_("init jobserver pipe"), errno);
|
|
|
71dafe |
}
|
|
|
71dafe |
|
|
|
71dafe |
/* Fill in the jobserver_fds struct for our children. */
|
|
|
71dafe |
@@ -2226,7 +2226,7 @@ main (int argc, char **argv, char **envp
|
|
|
71dafe |
/* If there is a temp file from reading a makefile from stdin, get rid of
|
|
|
71dafe |
it now. */
|
|
|
71dafe |
if (stdin_nm && unlink (stdin_nm) < 0 && errno != ENOENT)
|
|
|
71dafe |
- perror_with_name (_("unlink (temporary file): "), stdin_nm);
|
|
|
71dafe |
+ perror_with_name_err (_("unlink (temporary file): "), stdin_nm, errno);
|
|
|
71dafe |
|
|
|
71dafe |
/* If there were no command-line goals, use the default. */
|
|
|
71dafe |
if (goals == 0)
|
|
|
71dafe |
Только в make-3.82-pm: job.c~
|
|
|
71dafe |
Только в make-3.82-pm: main.c~
|
|
|
71dafe |
diff -urp make-3.82/make.h make-3.82-pm/make.h
|
|
|
71dafe |
--- make-3.82/make.h 2010-08-11 15:34:12.000000000 +0200
|
|
|
71dafe |
+++ make-3.82-pm/make.h 2010-08-11 15:31:26.000000000 +0200
|
|
|
71dafe |
@@ -385,6 +385,8 @@ void die (int) __attribute__ ((noreturn)
|
|
|
71dafe |
void log_working_directory (int);
|
|
|
71dafe |
void pfatal_with_name (const char *) __attribute__ ((noreturn));
|
|
|
71dafe |
void perror_with_name (const char *, const char *);
|
|
|
71dafe |
+void pfatal_with_name_err (const char *, int errnum) __attribute__ ((noreturn));
|
|
|
71dafe |
+void perror_with_name_err (const char *, const char *, int errnum);
|
|
|
71dafe |
void *xmalloc (unsigned int);
|
|
|
71dafe |
void *xcalloc (unsigned int);
|
|
|
71dafe |
void *xrealloc (void *, unsigned int);
|
|
|
71dafe |
diff -urp make-3.82/job.c make-3.82-pm/job.c
|
|
|
71dafe |
--- make-3.82/job.c 2010-07-24 10:27:50.000000000 +0200
|
|
|
71dafe |
+++ make-3.82-pm/job.c 2010-08-11 15:33:54.000000000 +0200
|
|
|
71dafe |
@@ -917,7 +917,7 @@ free_child (struct child *child)
|
|
|
71dafe |
|
|
|
71dafe |
EINTRLOOP (r, write (job_fds[1], &token, 1));
|
|
|
71dafe |
if (r != 1)
|
|
|
71dafe |
- pfatal_with_name (_("write jobserver"));
|
|
|
71dafe |
+ pfatal_with_name_err (_("write jobserver"), errno);
|
|
|
71dafe |
|
|
|
71dafe |
DB (DB_JOBS, (_("Released token for child %p (%s).\n"),
|
|
|
71dafe |
child, child->file->name));
|
|
|
71dafe |
@@ -1768,6 +1768,7 @@ new_job (struct file *file)
|
|
|
71dafe |
|
|
|
71dafe |
/* Set interruptible system calls, and read() for a job token. */
|
|
|
71dafe |
set_child_handler_action_flags (1, waiting_jobs != NULL);
|
|
|
71dafe |
+ errno = 0;
|
|
|
71dafe |
got_token = read (job_rfd, &token, 1);
|
|
|
71dafe |
saved_errno = errno;
|
|
|
71dafe |
set_child_handler_action_flags (0, waiting_jobs != NULL);
|
|
|
71dafe |
@@ -1782,10 +1783,14 @@ new_job (struct file *file)
|
|
|
71dafe |
|
|
|
71dafe |
/* If the error _wasn't_ expected (EINTR or EBADF), punt. Otherwise,
|
|
|
71dafe |
go back and reap_children(), and try again. */
|
|
|
71dafe |
- errno = saved_errno;
|
|
|
71dafe |
- if (errno != EINTR && errno != EBADF)
|
|
|
71dafe |
- pfatal_with_name (_("read jobs pipe"));
|
|
|
71dafe |
- if (errno == EBADF)
|
|
|
71dafe |
+ if (saved_errno != EINTR && saved_errno != EBADF)
|
|
|
71dafe |
+ {
|
|
|
71dafe |
+ if (got_token == 0)
|
|
|
71dafe |
+ fatal (NILF, _("read jobs pipe EOF"));
|
|
|
71dafe |
+ else
|
|
|
71dafe |
+ pfatal_with_name_err (_("read jobs pipe"), saved_errno);
|
|
|
71dafe |
+ }
|
|
|
71dafe |
+ if (saved_errno == EBADF)
|
|
|
71dafe |
DB (DB_JOBS, ("Read returned EBADF.\n"));
|
|
|
71dafe |
}
|
|
|
71dafe |
#endif
|
|
|
71dafe |
@@ -1909,7 +1914,8 @@ load_too_high (void)
|
|
|
71dafe |
error (NILF,
|
|
|
71dafe |
_("cannot enforce load limits on this operating system"));
|
|
|
71dafe |
else
|
|
|
71dafe |
- perror_with_name (_("cannot enforce load limit: "), "getloadavg");
|
|
|
71dafe |
+ perror_with_name_err (_("cannot enforce load limit: "),
|
|
|
71dafe |
+ "getloadavg", errno);
|
|
|
71dafe |
}
|
|
|
71dafe |
lossage = errno;
|
|
|
71dafe |
load = 0;
|
|
|
71dafe |
Только в make-3.82-pm: make.h~
|
|
|
71dafe |
Только в make-3.82-pm: misc.c.orig
|