summaryrefslogtreecommitdiff
path: root/xinit.c
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@freedesktop.org>2008-04-25 15:12:54 -0700
committerJeremy Huddleston <jeremyhu@freedesktop.org>2008-04-25 15:12:54 -0700
commit0806ae2ecfdcb4ad5f3b7a66dcc9bc5d29d72649 (patch)
tree74e00ab4d82a5037597861c2f7a7e9c3d01e0a46 /xinit.c
parentedc3112679af749f0c6fc54b2eec1b89aaf0d0c8 (diff)
downloadxorg-app-xinit-0806ae2ecfdcb4ad5f3b7a66dcc9bc5d29d72649.tar.gz
Apple: Use CFProcessPath instead of argv[0] trick.
Diffstat (limited to 'xinit.c')
-rw-r--r--xinit.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/xinit.c b/xinit.c
index d8e7c47..3de74c3 100644
--- a/xinit.c
+++ b/xinit.c
@@ -177,7 +177,7 @@ static char *displayNum = NULL;
static char *program = NULL;
static Display *xd = NULL; /* server connection */
#ifdef __APPLE__
-static char x11_path[PATH_MAX];
+static char x11_path[PATH_MAX + 1];
#endif
#ifndef SYSV
#if defined(__CYGWIN__) || defined(SVR4) || defined(_POSIX_SOURCE) || defined(CSRG_BASED) || defined(__UNIXOS2__) || defined(Lynx) || defined(__APPLE__)
@@ -266,18 +266,17 @@ static void
Execute(char **vec, /* has room from up above */
char **envp)
{
- char *file = vec[0];
#ifdef __APPLE__
/* This is ugly, but currently, we need to trick OS-X into thinking X is in
* the X11.app bundle. Hopefully UI, icons, etc will eventually be set
* by Xquartz, but this is how we're doing it for now. -JH
*/
- if(!strcmp(file, "/usr/X11/bin/X") || !strcmp(file, "/usr/X11/bin/Xquartz") || !strcmp(file, "X") || !strcmp(file, "Xquartz")) {
- vec[0] = x11_path;
- fprintf(stderr, "xinit: Detected Xquartz startup, setting file=%s, argv[0]=%s\n", file, vec[0]);
+ if(!strcmp(vec[0], "/usr/X11/bin/X") || !strcmp(vec[0], "/usr/X11/bin/Xquartz") || !strcmp(vec[0], "X") || !strcmp(vec[0], "Xquartz")) {
+ setenv("CFProcessPath", x11_path, 1);
+ fprintf(stderr, "xinit: Detected Xquartz startup, setting CFProcessPath=%s\n", x11_path);
}
#endif
- Execvpe (file, vec, envp);
+ Execvpe (vec[0], vec, envp);
#ifndef __UNIXOS2__
if (access (vec[0], R_OK) == 0) {
vec--; /* back it up to stuff shell in */