about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-03-10 10:43:09 -0500
committerRich Felker <dalias@aerifal.cx>2011-03-10 10:43:09 -0500
commit0a949ebdf0b9fc054ea868bd049c8f2c7aed973e (patch)
treeada444cb90129a58e80b116a40e6e2dddabd6e52
parent0558683d3db05bc7022be57bc8ece9699df24228 (diff)
downloadmusl-0a949ebdf0b9fc054ea868bd049c8f2c7aed973e.tar.gz
musl-0a949ebdf0b9fc054ea868bd049c8f2c7aed973e.tar.xz
musl-0a949ebdf0b9fc054ea868bd049c8f2c7aed973e.zip
don't fail with EINTR in sigtimedwait
POSIX allows either behavior, but sigwait is not allowed to fail with
EINTR, so the retry loop would have to be in one or the other anyway.
-rw-r--r--src/signal/sigtimedwait.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/signal/sigtimedwait.c b/src/signal/sigtimedwait.c
index 155185de..0a7c5eac 100644
--- a/src/signal/sigtimedwait.c
+++ b/src/signal/sigtimedwait.c
@@ -1,12 +1,12 @@
 #include <signal.h>
+#include <errno.h>
 #include "syscall.h"
 
 int sigtimedwait(const sigset_t *mask, siginfo_t *si, const struct timespec *timeout)
 {
-	long k_timeout[2];
-	if (timeout) {
-		k_timeout[0] = timeout->tv_sec;
-		k_timeout[1] = timeout->tv_nsec;
-	}
-	return syscall4(__NR_rt_sigtimedwait, (long)mask, (long)si, timeout ? (long)k_timeout : 0, SYSCALL_SIGSET_SIZE);
+	int ret;
+	do {
+		ret = syscall4(__NR_rt_sigtimedwait, (long)mask, (long)si, (long)timeout, SYSCALL_SIGSET_SIZE);
+	} while (ret<0 && errno==EINTR);
+	return ret;
 }