On Tue, 2014-08-19 at 17:07 +0200, Samuel Thibault wrote:
> Svante Signell, le Tue 19 Aug 2014 16:23:05 +0200, a écrit :
> > I'll take a look. However, fixing this does not solve the permission
> > denied problem of fakeroot-hurd.
> 
> Sure, but at least it won't produce bogus binaries.

Attached is a patch for settrans.c. Tested in the build tree. Will be
install-tested when the build is completed.
--- a/utils/settrans.c.orig	2014-05-26 20:54:36.000000000 +0200
+++ b/utils/settrans.c	2014-08-19 17:12:18.000000000 +0200
@@ -280,8 +280,9 @@
 
   if (chroot_command)
     {
-      pid_t pid;
-      switch ((pid = fork ()))
+      pid_t child;
+      int status;
+      switch ((child = fork ()))
 	{
 	case -1:
 	  error (6, errno, "fork");
@@ -318,8 +319,15 @@
 	  break;
 
 	default: /* Parent.  */
-	  if (waitpid (pid, NULL, 0) == -1)
-	    error (8, errno, "waitpid");
+	  if (waitpid (child, &status, 0) != child)
+	    error (8, errno, "waitpid on %d", child);
+
+	  if (WIFSIGNALED (status))
+	    error (WTERMSIG (status) + 128, 0,
+		   "%s for child %d", strsignal (WTERMSIG (status)), child);
+	  if (WEXITSTATUS (status) != 0)
+	    error (WEXITSTATUS (status), 0,
+		   "Error %d for child %d", WEXITSTATUS (status), child);
 
 	  err = fsys_goaway (active_control, goaway_flags);
 	  if (err && err != EBUSY)

Reply via email to