summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremy@tifa.local>2008-02-19 00:00:11 -0800
committerJeremy Huddleston <jeremy@tifa.local>2008-02-19 00:01:42 -0800
commit5f5ec5db35e82ddd9659763875e5d6c63cf1b691 (patch)
tree8fcd946b44bba7f573e62fd58ac43dece019c206 /hw
parent6cbaf15e6109ba77819c4070f5b46c78237ec460 (diff)
XQuartz: unsetenv("DISPLAY") before startx if X11.app can't connect to it.
Also fix casting to silence warning. (cherry picked from commit a5cbf78471ec6e6ad672dc00118fc7edbd6ddc7c)
Diffstat (limited to 'hw')
-rw-r--r--hw/xquartz/bundle/bundle-main.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/hw/xquartz/bundle/bundle-main.c b/hw/xquartz/bundle/bundle-main.c
index 54d01368d..e97770a55 100644
--- a/hw/xquartz/bundle/bundle-main.c
+++ b/hw/xquartz/bundle/bundle-main.c
@@ -45,6 +45,7 @@ static char *command_from_prefs(const char *key, const char *default_value);
int main(int argc, char **argv) {
Display *display;
+ const char *s;
size_t i;
fprintf(stderr, "X11.app: main(): argc=%d\n", argc);
@@ -72,7 +73,12 @@ int main(int argc, char **argv) {
}
/* Start the server */
- fprintf(stderr, "X11.app: Could not connect to server. Starting X server.");
+ if(s = getenv("DISPLAY")) {
+ fprintf(stderr, "X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting). Starting X server.\n", s);
+ unsetenv("DISPLAY");
+ } else {
+ fprintf(stderr, "X11.app: Could not connect to server (DISPLAY is not set). Starting X server.\n");
+ }
return execute(command_from_prefs("startx_script", DEFAULT_STARTX));
}
@@ -93,7 +99,7 @@ static int execute(const char *command) {
fprintf(stderr, "\targv[%d] = %s\n", s - newargv, *s);
}
- execvp (newargv[0], (const char **) newargv);
+ execvp (newargv[0], (char * const *) newargv);
perror ("X11.app: Couldn't exec.");
return(1);
}