mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
sigwait: Do not fail with EINTR and return error code [BZ #22478]
Since
commit 8b0e795aaa
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Nov 1 11:49:05 2017 -0200
Simplify Linux sig{timed}wait{info} implementations
sigwait can fail with EINTR. Applications do not expect that, and the
error code is not documented in POSIX or the manual pages.
This commit restores the previous behavior by retrying the system call
on EINTR. It also returns the error code, not -1, on the remaing
errors.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
@ -17,13 +17,20 @@
|
||||
|
||||
#include <signal.h>
|
||||
#include <sysdep-cancel.h>
|
||||
#include <errno.h>
|
||||
|
||||
int
|
||||
__sigwait (const sigset_t *set, int *sig)
|
||||
{
|
||||
siginfo_t si;
|
||||
if (__sigtimedwait (set, &si, 0) < 0)
|
||||
return -1;
|
||||
int ret;
|
||||
do
|
||||
ret = __sigtimedwait (set, &si, 0);
|
||||
/* Applications do not expect sigwait to return with EINTR, and the
|
||||
error code is not specified by POSIX. */
|
||||
while (ret < 0 && errno == EINTR);
|
||||
if (ret < 0)
|
||||
return errno;
|
||||
*sig = si.si_signo;
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user