su: add segmentation fault reporting of the child process

Child processes that ended with segmentation fault previously
indicated this with return status only. The report is now more
verbose if core dump is allowed.

Improved-by: Pádraig Brady <P@draigBrady.com>
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
This commit is contained in:
Ondrej Oprala 2012-09-11 16:39:17 +02:00 committed by Karel Zak
parent da30cb2a87
commit ea8a10391b
1 changed files with 6 additions and 1 deletions

View File

@ -300,7 +300,12 @@ create_watching_parent (void)
}
if (pid != (pid_t)-1)
if (WIFSIGNALED (status))
status = WTERMSIG (status) + 128;
{
status = WTERMSIG (status) + 128;
if (WCOREDUMP (status))
fprintf (stderr, _("%s (core dumped)\n"),
strsignal (WTERMSIG (status)));
}
else
status = WEXITSTATUS (status);
else