diff options
Diffstat (limited to 'rt/shm_open.c')
-rw-r--r-- | rt/shm_open.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/rt/shm_open.c b/rt/shm_open.c index a89aac4102..40eb8902a8 100644 --- a/rt/shm_open.c +++ b/rt/shm_open.c @@ -18,13 +18,15 @@ #include <errno.h> #include <fcntl.h> +#include <not-cancel.h> #include <pthread.h> +#include <shlib-compat.h> #include <shm-directory.h> #include <unistd.h> /* Open shared memory object. */ int -shm_open (const char *name, int oflag, mode_t mode) +__shm_open (const char *name, int oflag, mode_t mode) { struct shmdir_name dirname; if (__shm_get_name (&dirname, name, false) != 0) @@ -35,18 +37,17 @@ shm_open (const char *name, int oflag, mode_t mode) oflag |= O_NOFOLLOW | O_CLOEXEC; - /* Disable asynchronous cancellation. */ - int state; - pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &state); - - int fd = open (dirname.name, oflag, mode); + int fd = __open64_nocancel (dirname.name, oflag, mode); if (fd == -1 && __glibc_unlikely (errno == EISDIR)) /* It might be better to fold this error with EINVAL since directory names are just another example for unsuitable shared object names and the standard does not mention EISDIR. */ __set_errno (EINVAL); - pthread_setcancelstate (state, NULL); - return fd; } +versioned_symbol (libc, __shm_open, shm_open, GLIBC_2_34); + +#if OTHER_SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_34) +compat_symbol (libc, __shm_open, shm_open, GLIBC_2_2); +#endif |