summaryrefslogtreecommitdiff
path: root/src/mman
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-07-20 13:19:14 -0400
committerRich Felker <dalias@aerifal.cx>2013-07-20 13:19:14 -0400
commitce8a99578254242a89adbde1cbbf0f34daeec79b (patch)
treee6277c4c6af2216d7376af0d8016a430f3b8b44d /src/mman
parent1d92cddb1e1ed4b6cc0e55461727561e7a2522e0 (diff)
downloadmusl-ce8a99578254242a89adbde1cbbf0f34daeec79b.tar.gz
fix shm_open wrongly being cancellable
Diffstat (limited to 'src/mman')
-rw-r--r--src/mman/shm_open.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mman/shm_open.c b/src/mman/shm_open.c
index b23eac7f..d042a5a8 100644
--- a/src/mman/shm_open.c
+++ b/src/mman/shm_open.c
@@ -4,6 +4,7 @@
#include <unistd.h>
#include <string.h>
#include <limits.h>
+#include <pthread.h>
char *__strchrnul(const char *, int);
@@ -27,9 +28,13 @@ char *__shm_mapname(const char *name, char *buf)
int shm_open(const char *name, int flag, mode_t mode)
{
+ int cs;
char buf[NAME_MAX+10];
if (!(name = __shm_mapname(name, buf))) return -1;
- return open(name, flag|O_NOFOLLOW|O_CLOEXEC|O_NONBLOCK, mode);
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
+ int fd = open(name, flag|O_NOFOLLOW|O_CLOEXEC|O_NONBLOCK, mode);
+ pthread_setcancelstate(cs, 0);
+ return fd;
}
int shm_unlink(const char *name)