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