https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113957
--- Comment #1 from Iain Sandoe <iains at gcc dot gnu.org> ---
the problem is that liberty is using the value set by posix_spawnp for pid.
but:
(darwin):
The argument pid is a pointer to a pid_t variable to receive the pid of
the spawned process; if this is NULL, then the pid of the spawned process is
not returned. If this pointer is non-NULL, then on
successful completion, the variable will be modified to contain the pid of
the spawned process. The value is undefined in the case of a failure.
(linux):
Upon successful completion, posix_spawn() and posix_spawnp() place the PID of
the child process in pid, and return 0. If there is an error during the fork()
step, then no child is created, the contents of *pid are
unspecified, and these functions return an error number as described
below.
So .. I think the fix will be to set pid = -1 in the error paths .. will try
that.