xserver: Branch 'xorg-server-1.2-apple'

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Tue Feb 19 00:01:39 PST 2008


 hw/xquartz/bundle/bundle-main.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit a5cbf78471ec6e6ad672dc00118fc7edbd6ddc7c
Author: Jeremy Huddleston <jeremy at tifa.local>
Date:   Tue Feb 19 00:00:11 2008 -0800

    XQuartz: unsetenv("DISPLAY") before startx if X11.app can't connect to it.
    Also fix casting to silence warning.

diff --git a/hw/xquartz/bundle/bundle-main.c b/hw/xquartz/bundle/bundle-main.c
index 54d0136..e97770a 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);
 }


More information about the xorg-commit mailing list