diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2016-09-14 14:07:20 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2016-09-20 17:18:15 -0300 |
commit | 706e6749de9667f3f3763743a294d28f895f4fa9 (patch) | |
tree | 7494003744445d24f80373451027548d74607ff7 /sysdeps | |
parent | aea5c83461dac53b8619b7bf2ef1fb348ecb4ef1 (diff) | |
download | glibc-706e6749de9667f3f3763743a294d28f895f4fa9.tar.gz glibc-706e6749de9667f3f3763743a294d28f895f4fa9.tar.xz glibc-706e6749de9667f3f3763743a294d28f895f4fa9.zip |
posix: Correctly enable/disable cancellation on Linux posix_spawn
This patch correctly enable and disable asynchronous cancellation on Linux posix_spawn. Current code invert the logic by enabling and disabling instead. It also adds a new test to check if posix_spawn is not a cancellation entrypoint. Checked on x86_64, i686, powerpc64le, and aarch64. * nptl/Makefile (tests): Add tst-exec5. * nptl/tst-exec5.c: New file. * sysdeps/unix/sysv/linux/spawni.c (__spawni): Correctly enable and disable asynchronous cancellation.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/unix/sysv/linux/spawni.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c index bb3eecfde1..5c5fcad5f4 100644 --- a/sysdeps/unix/sysv/linux/spawni.c +++ b/sysdeps/unix/sysv/linux/spawni.c @@ -340,7 +340,9 @@ __spawnix (pid_t * pid, const char *file, } /* Disable asynchronous cancellation. */ - int cs = LIBC_CANCEL_ASYNC (); + int state; + __libc_ptf_call (__pthread_setcancelstate, + (PTHREAD_CANCEL_DISABLE, &state), 0); args.file = file; args.exec = exec; @@ -386,7 +388,7 @@ __spawnix (pid_t * pid, const char *file, __sigprocmask (SIG_SETMASK, &args.oldmask, 0); - LIBC_CANCEL_RESET (cs); + __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0); return ec; } |