[PATCHv2] posix_spawn: skip SIGKILL & SIGSTOP

王宇逸 <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <TYCPR01MB10926A7C1374B9CB3F7D493C8F8D12@TYCPR01MB10926.jpnprd01.prod.outlook.com>
From: Yuyi Wang <[email protected]>

sigaction() returns EINVAL on SIGKILL & SIGSTOP. We need to skip them.
---
 newlib/libc/posix/posix_spawn.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/newlib/libc/posix/posix_spawn.c b/newlib/libc/posix/posix_spawn.c
index 6fd6159d0..46e4e5369 100644
--- a/newlib/libc/posix/posix_spawn.c
+++ b/newlib/libc/posix/posix_spawn.c
@@ -199,6 +199,8 @@ process_spawnattr(const posix_spawnattr_t sa)
 
 	if (sa->sa_flags & POSIX_SPAWN_SETSIGDEF) {
 		for (i = 1; i < NSIG; i++) {
+			if (i == SIGKILL || i == SIGSTOP)
+				continue;
 			if (sigismember(&sa->sa_sigdefault, i))
 				if (sigaction(i, &sigact, NULL) != 0)
 					return (errno);
-- 
2.48.1.windows.1-2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.