mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
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.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user