mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-03-28 07:58:44 -04:00
compat: prefer waitpid() over waitid()
while both are defined by POSIX, waitpid() is more common than waitid(). Signed-off-by: Sebastien Marie <semarie@online.fr>
This commit is contained in:
parent
a74aa93394
commit
791912c678
2 changed files with 19 additions and 27 deletions
|
|
@ -103,26 +103,23 @@ handle_client_destroy(void *data)
|
|||
{
|
||||
struct client_info *ci = data;
|
||||
struct display *d;
|
||||
siginfo_t status;
|
||||
int status;
|
||||
|
||||
d = ci->display;
|
||||
|
||||
assert(waitid(P_PID, ci->pid, &status, WEXITED) != -1);
|
||||
assert(waitpid(ci->pid, &status, 0) != -1);
|
||||
|
||||
switch (status.si_code) {
|
||||
case CLD_KILLED:
|
||||
case CLD_DUMPED:
|
||||
if (WIFSIGNALED(status)) {
|
||||
fprintf(stderr, "Client '%s' was killed by signal %d\n",
|
||||
ci->name, status.si_status);
|
||||
ci->kill_code = status.si_status;
|
||||
break;
|
||||
case CLD_EXITED:
|
||||
if (status.si_status != EXIT_SUCCESS)
|
||||
fprintf(stderr, "Client '%s' exited with code %d\n",
|
||||
ci->name, status.si_status);
|
||||
ci->name, WTERMSIG(status));
|
||||
ci->kill_code = WTERMSIG(status);
|
||||
|
||||
ci->exit_code = status.si_status;
|
||||
break;
|
||||
} else if (WIFEXITED(status)) {
|
||||
if (WEXITSTATUS(status) != EXIT_SUCCESS)
|
||||
fprintf(stderr, "Client '%s' exited with code %d\n",
|
||||
ci->name, WEXITSTATUS(status));
|
||||
|
||||
ci->exit_code = WEXITSTATUS(status);
|
||||
}
|
||||
|
||||
++d->clients_terminated_no;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue