From: Rich Felker Date: Sat, 20 Jul 2013 17:19:14 +0000 (-0400) Subject: fix shm_open wrongly being cancellable X-Git-Tag: v0.9.12~54 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ce8a99578254242a89adbde1cbbf0f34daeec79b;p=oweals%2Fmusl.git fix shm_open wrongly being cancellable --- 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 #include #include +#include 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)