Commit be32b341 authored by Alexandre Julliard's avatar Alexandre Julliard

libport: Work around Mac OS execve() breakage.

parent 0f5fc117
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <errno.h> #include <errno.h>
#include <signal.h> #include <signal.h>
#include <stdlib.h>
#ifdef HAVE_SYS_WAIT_H #ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h> #include <sys/wait.h>
#endif #endif
...@@ -41,7 +42,8 @@ int spawnvp(int mode, const char *cmdname, const char *const argv[]) ...@@ -41,7 +42,8 @@ int spawnvp(int mode, const char *cmdname, const char *const argv[])
if (mode == _P_OVERLAY) if (mode == _P_OVERLAY)
{ {
execvp(cmdname, (char **)argv); 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; dfl_act.sa_handler = SIG_DFL;
...@@ -58,6 +60,8 @@ int spawnvp(int mode, const char *cmdname, const char *const argv[]) ...@@ -58,6 +60,8 @@ int spawnvp(int mode, const char *cmdname, const char *const argv[])
_exit(1); _exit(1);
} }
if (pid != -1 && mode == _P_OVERLAY) exit(0);
if (pid != -1 && mode == _P_WAIT) if (pid != -1 && mode == _P_WAIT)
{ {
while (pid != (wret = waitpid(pid, &status, 0))) while (pid != (wret = waitpid(pid, &status, 0)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment