mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Signal handler of SIGCHLD calls waitpid() which sets errno on error. To
avoid clubbering of errno in normal context, save_errno got introduced. ok oga
This commit is contained in:
parent
cd0ce46817
commit
458f96936d
3
calmwm.c
3
calmwm.c
@ -300,12 +300,15 @@ static void
|
|||||||
_sigchld_cb(int which)
|
_sigchld_cb(int which)
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
int save_errno = errno;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
/* Collect dead children. */
|
/* Collect dead children. */
|
||||||
while ((pid = waitpid(-1, &status, WNOHANG)) > 0 ||
|
while ((pid = waitpid(-1, &status, WNOHANG)) > 0 ||
|
||||||
(pid < 0 && errno == EINTR))
|
(pid < 0 && errno == EINTR))
|
||||||
;
|
;
|
||||||
|
|
||||||
|
errno = save_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
__dead void
|
__dead void
|
||||||
|
Loading…
Reference in New Issue
Block a user