summaryrefslogtreecommitdiff
path: root/lib/wait-process.c
diff options
context:
space:
mode:
authorDerek R. Price <derek@ximbiot.com>2006-04-25 20:58:26 +0000
committerDerek R. Price <derek@ximbiot.com>2006-04-25 20:58:26 +0000
commit6d8d4e520be656b646a6f5cf7ebebfc31c178022 (patch)
tree99edbed416b6e9dba5124a90985c54586451902f /lib/wait-process.c
parent528b229aa8932bc5e1fdf7b0c7cdc5b7713b1edf (diff)
downloadgnulib-6d8d4e520be656b646a6f5cf7ebebfc31c178022.tar.gz
* lib/wait-process.h (wait_subprocess): Accept a new exitsignal argument.
* lib/wait-process.c (wait_subprocess): Always set *exitsignal to 0 when present and set it to the offending signal when the child exits due to a signal. * lib/csharpcomp.c, lib/execute.c, lib/javacomp.c: Update all callers.
Diffstat (limited to 'lib/wait-process.c')
-rw-r--r--lib/wait-process.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/wait-process.c b/lib/wait-process.c
index 221a39c10e..0fd6f26676 100644
--- a/lib/wait-process.c
+++ b/lib/wait-process.c
@@ -251,7 +251,7 @@ unregister_slave_subprocess (pid_t child)
If it didn't terminate correctly, exit if exit_on_error is true, otherwise
return 127. */
int
-wait_subprocess (pid_t child, const char *progname,
+wait_subprocess (pid_t child, const char *progname, int *exitsignal,
bool ignore_sigpipe, bool null_stderr,
bool slave_process, bool exit_on_error)
{
@@ -345,6 +345,7 @@ wait_subprocess (pid_t child, const char *progname,
WAIT_T status;
*(int *) &status = 0;
+ if (exitsignal) *exitsignal = 0;
for (;;)
{
int result = waitpid (child, &status, 0);
@@ -394,6 +395,7 @@ wait_subprocess (pid_t child, const char *progname,
error (exit_on_error ? EXIT_FAILURE : 0, 0,
_("%s subprocess got fatal signal %d"),
progname, (int) WTERMSIG (status));
+ if (exitsignal) *exitsignal = WTERMSIG (status);
return 127;
}
if (WEXITSTATUS (status) == 127)