1 --- make-3.80/misc.c.jj 2002-09-12 18:15:58.000000000 -0400
2 +++ make-3.80/misc.c 2005-08-22 05:46:05.000000000 -0400
3 @@ -311,17 +311,31 @@ strerror (errnum)
4 /* Print an error message from errno. */
7 +perror_with_name_err (const char *str, const char *name, int errnum)
9 + error (NILF, _("%s%s: %s"), str, name, strerror (errnum));
13 perror_with_name (const char *str, const char *name)
15 - error (NILF, _("%s%s: %s"), str, name, strerror (errno));
16 + perror_with_name_err (str, name, errno);
19 /* Print an error message from errno and exit. */
22 +pfatal_with_name_err (const char *name, int errnum)
24 + fatal (NILF, _("%s: %s"), name, strerror (errnum));
30 pfatal_with_name (const char *name)
32 - fatal (NILF, _("%s: %s"), name, strerror (errno));
33 + pfatal_with_name_err (name, errno);
38 --- make-3.81/main.c.jj 2006-05-23 12:51:25.000000000 +0200
39 +++ make-3.81/main.c 2006-05-23 12:50:48.000000000 +0200
40 @@ -1502,13 +1502,13 @@
41 strcat (template, DEFAULT_TMPFILE);
42 outfile = open_tmpfile (&stdin_nm, template);
44 - pfatal_with_name (_("fopen (temporary file)"));
45 + pfatal_with_name_err (_("fopen (temporary file)"), errno);
46 while (!feof (stdin) && ! ferror (stdin))
49 unsigned int n = fread (buf, 1, sizeof (buf), stdin);
50 if (n > 0 && fwrite (buf, 1, n, outfile) != n)
51 - pfatal_with_name (_("fwrite (temporary file)"));
52 + pfatal_with_name_err (_("fwrite (temporary file)"), errno);
54 (void) fclose (outfile);
57 else if ((job_rfd = dup (job_fds[0])) < 0)
60 - pfatal_with_name (_("dup jobserver"));
61 + pfatal_with_name_err (_("dup jobserver"), errno);
64 _("warning: jobserver unavailable: using -j1. Add `+' to parent make rule."));
68 if (pipe (job_fds) < 0 || (job_rfd = dup (job_fds[0])) < 0)
69 - pfatal_with_name (_("creating jobs pipe"));
70 + pfatal_with_name_err (_("creating jobs pipe"), errno);
72 /* Every make assumes that it always has one job it can run. For the
73 submakes it's the token they were given by their parent. For the
76 EINTRLOOP (r, write (job_fds[1], &c, 1));
78 - pfatal_with_name (_("init jobserver pipe"));
79 + pfatal_with_name_err (_("init jobserver pipe"), errno);
82 /* Fill in the jobserver_fds struct for our children. */
84 /* If there is a temp file from reading a makefile from stdin, get rid of
86 if (stdin_nm && unlink (stdin_nm) < 0 && errno != ENOENT)
87 - perror_with_name (_("unlink (temporary file): "), stdin_nm);
88 + perror_with_name_err (_("unlink (temporary file): "), stdin_nm, errno);
93 --- make-3.81/make.h.jj 2006-05-23 12:54:45.000000000 +0200
94 +++ make-3.81/make.h 2006-05-23 12:55:00.000000000 +0200
96 extern void log_working_directory PARAMS ((int));
97 extern void pfatal_with_name PARAMS ((const char *)) __attribute__ ((noreturn));
98 extern void perror_with_name PARAMS ((const char *, const char *));
99 +extern void pfatal_with_name_err PARAMS ((const char *, int errnum)) __attribute__ ((noreturn));
100 +extern void perror_with_name_err PARAMS ((const char *, const char *, int errnum));
101 extern char *savestring PARAMS ((const char *, unsigned int));
102 extern char *concat PARAMS ((const char *, const char *, const char *));
103 extern char *xmalloc PARAMS ((unsigned int));
105 --- make-3.81/job.c.jj 2006-05-23 13:01:35.000000000 +0200
106 +++ make-3.81/job.c 2006-05-23 13:50:44.000000000 +0200
109 EINTRLOOP (r, write (job_fds[1], &token, 1));
111 - pfatal_with_name (_("write jobserver"));
112 + pfatal_with_name_err (_("write jobserver"), errno);
114 DB (DB_JOBS, (_("Released token for child 0x%08lx (%s).\n"),
115 (unsigned long int) child, child->file->name));
116 @@ -1699,6 +1699,7 @@
118 /* Set interruptible system calls, and read() for a job token. */
119 set_child_handler_action_flags (1, waiting_jobs != NULL);
121 got_token = read (job_rfd, &token, 1);
123 set_child_handler_action_flags (0, waiting_jobs != NULL);
124 @@ -1713,10 +1714,14 @@
126 /* If the error _wasn't_ expected (EINTR or EBADF), punt. Otherwise,
127 go back and reap_children(), and try again. */
128 - errno = saved_errno;
129 - if (errno != EINTR && errno != EBADF)
130 - pfatal_with_name (_("read jobs pipe"));
131 - if (errno == EBADF)
132 + if (saved_errno != EINTR && saved_errno != EBADF)
134 + if (got_token == 0)
135 + fatal (NILF, _("read jobs pipe EOF"));
137 + pfatal_with_name_err (_("read jobs pipe"), saved_errno);
139 + if (saved_errno == EBADF)
140 DB (DB_JOBS, ("Read returned EBADF.\n"));
143 @@ -1831,7 +1836,7 @@
145 _("cannot enforce load limits on this operating system"));
147 - perror_with_name (_("cannot enforce load limit: "), "getloadavg");
148 + perror_with_name_err (_("cannot enforce load limit: "), "getloadavg", errno);