]> git.sesse.net Git - vlc/commitdiff
macosx: Use fork+exec instead of posix_spawn.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Tue, 16 Sep 2008 20:01:23 +0000 (22:01 +0200)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Tue, 16 Sep 2008 20:02:42 +0000 (22:02 +0200)
(As pointed by Remi)

Note, this doesn't work with just exec() for some obscure reason.

modules/gui/macosx/intf.m

index ad0143bc40eff7e7d6ef6cc33a90fb8718d24b17..7a7643f7c1e0155be130df7781e61fb3dcddf6cb 100644 (file)
@@ -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 -