On Tue, 19 Aug 2014 15:30:43 +0200 Samuel Thibault <samuel.thiba...@gnu.org> wrote:
> Hello, > > In short: > > youpi@exodar:~$ fakeroot-hurd false > /bin/fakeauth: Error 1 for child 28735 > youpi@exodar:~$ echo $? > 0 > > It should be 1. That's the reason why the gnat-4.9 build failure went > unnoticed. > > The source in hurd/utils/settrans.c, when chroot_command is given, > indeed forks and waitpid()s for the child, but does not exit() with the > status of the child. That should be an easy fix for somebody with some > time under his hand, getting inspired from hurd/utils/fakeauth.c which > does things appropriately. > > Samuel Hello! Sorry for absolutely incorrect format, etc. I just did it as an exercise. Please, give your feedback if you're ready to waste some of your time :-) [PATCH] exit() with the status of the child when chroot_command is given --- utils/settrans.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/utils/settrans.c b/utils/settrans.c index 84b271a..4b5d10a 100644 --- a/utils/settrans.c +++ b/utils/settrans.c @@ -114,6 +114,7 @@ main(int argc, char *argv[]) int excl = 0; int timeout = DEFAULT_TIMEOUT * 1000; /* ms */ char **chroot_command = 0; + int status; /* Parse our options... */ error_t parse_opt (int key, char *arg, struct argp_state *state) @@ -348,9 +349,17 @@ main(int argc, char *argv[]) break; default: /* Parent. */ - if (waitpid (pid, NULL, 0) == -1) + if (waitpid (pid, &status, 0) == -1) error (8, errno, "waitpid"); + if (WIFSIGNALED (status)) + error (WTERMSIG (status) + 128, 0, + "%s for child", strsignal (WTERMSIG (status))); + + if (WIFEXITED (status)) + error (WEXITSTATUS (status), 0, + "Error %d for child", WEXITSTATUS (status)); + err = fsys_goaway (active_control, goaway_flags); if (err && err != EBUSY) error (9, err, "fsys_goaway"); -- 2.1.0.rc1 I have a question: why in case WIFSIGNALED the value of status is increased by 128? Another one: why tabs and spaces are mixed in indents in that file? -- Regards, Anatoly
pgpezMlzfnWxh.pgp
Description: PGP signature