mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-22 09:57:52 +02:00
gbacktrace: Correctly wait for children on Unix
The WIF* macros are supposed to be used with the status, not the pid. Also, only check the status if no error occurred, otherwise the value might be uninitialized. If an unrecoverable error occurs, break the loop (could happen if SIGCHLD is ignored).
This commit is contained in:
@@ -290,7 +290,13 @@ g_on_error_stack_trace (const gchar *prg_name)
|
||||
while (1)
|
||||
{
|
||||
pid_t retval = waitpid (pid, &status, 0);
|
||||
if (WIFEXITED (retval) || WIFSIGNALED (retval))
|
||||
if (retval == -1)
|
||||
{
|
||||
if (errno == EAGAIN || errno == EINTR)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
else if (WIFEXITED (status) || WIFSIGNALED (status))
|
||||
break;
|
||||
}
|
||||
#else
|
||||
|
Reference in New Issue
Block a user