Paul Eggert wrote:
> For years, POSIX has recommended that multithreaded apps use 
> pthread_sigmask instead of sigprocmask.

The use of sigprocmask() in lib/spawni.c is harmless, since the
process is single-threaded at that point.


2026-04-04  Bruno Haible  <[email protected]>

        posix_spawn-internal: Remove a FIXME.
        * lib/spawni.c (__spawni): Add comment regarding sigprocmask.

diff --git a/lib/spawni.c b/lib/spawni.c
index 4c6d54e01c..9e34e95c11 100644
--- a/lib/spawni.c
+++ b/lib/spawni.c
@@ -937,10 +937,9 @@ __spawni (pid_t *pid, const char *file,
     }
 
   /* Set signal mask.  */
-  /* FIXME: Use pthread_sigmask, not sigprocmask, as the two functions
-     behave differently on macOS and the sigprocmask behavior can cause
-     this thread to race with other threads in harmful ways.  */
   if ((flags & POSIX_SPAWN_SETSIGMASK) != 0
+      /* Since we are in the child here and it has only the main thread so far,
+         it does not matter whether we call pthread_sigmask or sigprocmask.  */
       && sigprocmask (SIG_SETMASK, &attrp->_ss, NULL) != 0)
     _exit (SPAWN_ERROR);
 




Reply via email to