]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
posix_spawn: Don't give sigismember an invalid signal number.
authorCollin Funk <collin.funk1@gmail.com>
Wed, 29 Oct 2025 07:08:56 +0000 (00:08 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Wed, 29 Oct 2025 07:16:43 +0000 (00:16 -0700)
This caused the child process to exit with a 127 exit status on OpenBSD
and Solaris.

* lib/spawni.c (__spawni): Use < instead of <= when comparing the signal
number to NSIG.

ChangeLog
lib/spawni.c

index b475160780f288cb95971fe891db2bc7407ae059..1a0994fda227e2bad0e0483646282af05f2c4f58 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-10-29  Collin Funk  <collin.funk1@gmail.com>
+
+       posix_spawn: Don't give sigismember an invalid signal number.
+       This caused the child process to exit with a 127 exit status on OpenBSD
+       and Solaris.
+       * lib/spawni.c (__spawni): Use < instead of <= when comparing the signal
+       number to NSIG.
+
 2025-10-28  Paul Eggert  <eggert@cs.ucla.edu>
 
        openat2: port O_TMPFILE check to non-GNU/Linux
index 34c16445fc5ff810da336a77be34b1a7eea2a3fb..a1f3f84a98bdd862978253db31191de85d3646f2 100644 (file)
@@ -927,7 +927,7 @@ __spawni (pid_t *pid, const char *file,
       memset (&sa, '\0', sizeof (sa));
       sa.sa_handler = SIG_DFL;
 
-      for (sig = 1; sig <= NSIG; ++sig)
+      for (sig = 1; sig < NSIG; ++sig)
         if (sigismember (&attrp->_sd, sig) != 0
             && sigaction (sig, &sa, NULL) != 0)
           _exit (SPAWN_ERROR);