libport: Work around Mac OS execve() breakage.

This commit is contained in:
Alexandre Julliard 2007-11-19 14:57:27 +01:00
parent 0f5fc117a2
commit be32b3413c
1 changed files with 5 additions and 1 deletions

View File

@ -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 @@ int spawnvp(int mode, const char *cmdname, const char *const argv[])
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 @@ int spawnvp(int mode, const char *cmdname, const char *const argv[])
_exit(1);
}
if (pid != -1 && mode == _P_OVERLAY) exit(0);
if (pid != -1 && mode == _P_WAIT)
{
while (pid != (wret = waitpid(pid, &status, 0)))