Commit a921f15e authored by Pierre d'Herbemont's avatar Pierre d'Herbemont
Browse files

macosx: Use fork+exec instead of posix_spawn.

(As pointed by Remi)

Note, this doesn't work with just exec() for some obscure reason.
parent 92d90130
......@@ -31,7 +31,7 @@
#include <sys/param.h> /* for MAXPATHLEN */
#include <string.h>
#include <vlc_keys.h>
#include <spawn.h>
#include <unistd.h> /* execl() */
#ifdef HAVE_CONFIG_H
# include "config.h"
......@@ -2272,11 +2272,14 @@ end:
/* Relaunch now */
const char * path = [[[NSBundle mainBundle] executablePath] UTF8String];
const char *spawnedArgs[2] = { path, NULL };
char *spawnedEnv[] = {NULL};
posix_spawn(NULL, path, NULL, NULL, spawnedArgs, spawnedEnv);
exit(0);
/* For some reason we need to fork(), not just execl(), which reports a ENOTSUP then. */
if(fork() != 0)
{
exit(0);
return;
}
execl(path, path, NULL);
}
#pragma mark -
......
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