https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113957
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Iain D Sandoe <ia...@gcc.gnu.org>: https://gcc.gnu.org/g:20e57660e64eab7c9ef0f2dd25f3088835f8f44f commit r14-9072-g20e57660e64eab7c9ef0f2dd25f3088835f8f44f Author: Iain Sandoe <i...@sandoe.co.uk> Date: Fri Feb 16 14:42:53 2024 +0000 libiberty: Fix error return value in pex_unix_exec_child [PR113957]. r14-5310-g879cf9ff45d940 introduced some new handling for spawning sub processes. The return value from the generic exec_child is examined and needs to be < 0 to signal an error. However, the unix flavour of this routine is returning the PID value set from the posix_spawn{p}. This latter value is undefined per the manual pages for both Darwin and Linux, and it seems Darwin, at least, sets the value to some usually positive number (presumably the PID that would have been used if the fork had succeeded). The fix proposed here is to set the pid = -1 in the relevant error paths. PR other/113957 libiberty/ChangeLog: * pex-unix.c (pex_unix_exec_child): Set pid = -1 in the error paths, since that is used to signal an erroneous outcome for the routine. Signed-off-by: Iain Sandoe <i...@sandoe.co.uk>