libport: Work around Mac OS execve() breakage.
diff --git a/libs/port/spawn.c b/libs/port/spawn.c
index 832862c..490abb3 100644
--- a/libs/port/spawn.c
+++ b/libs/port/spawn.c
@@ -23,6 +23,7 @@
#include <errno.h>
#include <signal.h>
+#include <stdlib.h>
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
@@ -41,7 +42,8 @@
if (mode == _P_OVERLAY)
{
execvp(cmdname, (char **)argv);
- return -1; /* if we get here it failed */
+ /* if we get here it failed */
+ if (errno != ENOTSUP) return -1; /* exec fails on MacOS if the process has multiple threads */
}
dfl_act.sa_handler = SIG_DFL;
@@ -58,6 +60,8 @@
_exit(1);
}
+ if (pid != -1 && mode == _P_OVERLAY) exit(0);
+
if (pid != -1 && mode == _P_WAIT)
{
while (pid != (wret = waitpid(pid, &status, 0)))