commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd] 48/87: Make settrans return value returned by chroot command


From: Samuel Thibault
Subject: [hurd] 48/87: Make settrans return value returned by chroot command
Date: Sun, 09 Nov 2014 11:05:03 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream
in repository hurd.

commit d324631edd3c2549a8cda05c2fc56ceea7fe0593
Author: Svante Signell <address@hidden>
Date:   Tue Aug 19 19:52:01 2014 +0200

    Make settrans return value returned by chroot command
    
    * utils/settrans.c (main): In case of chroot_command, get status from 
waitpid()
    call, and call error() appropriately.
---
 utils/settrans.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/utils/settrans.c b/utils/settrans.c
index 84b271a..cd40c56 100644
--- a/utils/settrans.c
+++ b/utils/settrans.c
@@ -310,8 +310,9 @@ main(int argc, char *argv[])
 
   if (chroot_command)
     {
-      pid_t pid;
-      switch ((pid = fork ()))
+      pid_t child;
+      int status;
+      switch ((child = fork ()))
        {
        case -1:
          error (6, errno, "fork");
@@ -348,12 +349,19 @@ main(int argc, char *argv[])
          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);
 
          err = fsys_goaway (active_control, goaway_flags);
          if (err && err != EBUSY)
            error (9, err, "fsys_goaway");
+
+         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);
        }
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]