|
Message-Id: <B56E055D-9B25-49ED-B194-5E62E02808E0@gmail.com> Date: Fri, 23 Feb 2018 13:09:35 +0100 From: Julien Ramseier <j.ramseier@...il.com> To: musl@...ts.openwall.com Subject: [PATCH] sigtimedwait: allow failing with EINTR According to POSIX, sigtimedwait(2) is allowed to fail with EINTR, while sigwait(3) is not, so move the retry loop there. --- diff --git a/src/signal/sigtimedwait.c b/src/signal/sigtimedwait.c index 0739986b..97a526da 100644 --- a/src/signal/sigtimedwait.c +++ b/src/signal/sigtimedwait.c @@ -1,13 +1,8 @@ #include <signal.h> -#include <errno.h> #include "syscall.h" #include "libc.h" int sigtimedwait(const sigset_t *restrict mask, siginfo_t *restrict si, const struct timespec *restrict timeout) { - int ret; - do ret = syscall_cp(SYS_rt_sigtimedwait, mask, - si, timeout, _NSIG/8); - while (ret<0 && errno==EINTR); - return ret; + return syscall_cp(SYS_rt_sigtimedwait, mask, si, timeout, _NSIG/8); } diff --git a/src/signal/sigwait.c b/src/signal/sigwait.c index c8822eea..53d04803 100644 --- a/src/signal/sigwait.c +++ b/src/signal/sigwait.c @@ -1,10 +1,13 @@ +#include <errno.h> #include <signal.h> int sigwait(const sigset_t *restrict mask, int *restrict sig) { + int ret; siginfo_t si; - if (sigtimedwait(mask, &si, 0) < 0) - return -1; + do ret = sigtimedwait(mask, &si, 0); + while (ret<0 && errno==EINTR); + if (ret<0) return -1; *sig = si.si_signo; return 0; }
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.