summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2018-12-19 19:32:41 -0500
committerRich Felker <dalias@aerifal.cx>2018-12-19 19:32:41 -0500
commit21a172dd36cae7a08492fd3a7500d7bf0daee13e (patch)
tree8dbc3f7ffb682fee3da2ac71d269746c90935f6e /src
parent1ec71c531e118971e70ddd0e9e2ed9def2b3c779 (diff)
downloadmusl-21a172dd36cae7a08492fd3a7500d7bf0daee13e.tar.gz
musl-21a172dd36cae7a08492fd3a7500d7bf0daee13e.tar.bz2
musl-21a172dd36cae7a08492fd3a7500d7bf0daee13e.tar.xz
musl-21a172dd36cae7a08492fd3a7500d7bf0daee13e.zip
make sem_wait and sem_timedwait interruptible by signals
this reverts commit c0ed5a201b2bdb6d1896064bec0020c9973db0a1, which was based on a mistaken reading of POSIX due to inconsistency between the description (which requires return upon interruption by a signal) and the errors list (which wrongly lists EINTR as "may fail"). since the previously-introduced behavior was a workaround for an old kernel bug to ensure safety of correct programs that were not hardened against the bug, an effort has been made to preserve it for programs which do not use interrupting signal handlers. the stage for this was set in commit a63c0104e496f7ba78b64be3cd299b41e8cd427f, which makes the futex __timedwait backend suppress EINTR if it's seen when no interrupting signal handlers have been installed. based loosely on a patch submitted by Orivej Desh, but with unnecessary additional changes removed.
Diffstat (limited to 'src')
-rw-r--r--src/thread/sem_timedwait.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/thread/sem_timedwait.c b/src/thread/sem_timedwait.c
index 8132eb1b..58d3ebfe 100644
--- a/src/thread/sem_timedwait.c
+++ b/src/thread/sem_timedwait.c
@@ -22,7 +22,7 @@ int sem_timedwait(sem_t *restrict sem, const struct timespec *restrict at)
pthread_cleanup_push(cleanup, (void *)(sem->__val+1));
r = __timedwait_cp(sem->__val, -1, CLOCK_REALTIME, at, sem->__val[2]);
pthread_cleanup_pop(1);
- if (r && r != EINTR) {
+ if (r) {
errno = r;
return -1;
}