Complete.Org: Mailing Lists: Archives: freeciv-dev: January 1999:
[Freeciv-Dev] [patch] segfault on bad DISPLAY variable
Home

[Freeciv-Dev] [patch] segfault on bad DISPLAY variable

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] [patch] segfault on bad DISPLAY variable
From: Per Mathisen <permath@xxxxxxxxxxx>
Date: Thu, 28 Jan 1999 11:39:01 +0100 (MET)

On Fri, 15 Jan 1999, Nicolas BRUNEL wrote:
> Display *d;
> 
> if ((d = XOpenDisplay(getenv("DISPLAY"))) == NULL) {
>       fprintf(stderr,"Can't open display\n");
>         exit(1); }
>         else XtVaAppInitialize ...

That works. No more segfault. Here is a patch.

Yours,
Per

--- xmain.c.old Thu Jan 28 12:24:33 1999
+++ xmain.c     Thu Jan 28 12:30:48 1999
@@ -262,5 +262,9 @@
   /* XtSetLanguageProc(NULL, (XtLanguageProc)NULL, NULL); */
   
-  toplevel = XtVaAppInitialize(
+  Display *d;
+  if ((d = XOpenDisplay(getenv("DISPLAY"))) == NULL) {
+       fprintf(stderr, "Can't open X-Windows display.\n");
+       exit(1);
+  } else toplevel = XtVaAppInitialize(
               &app_context,               /* Application context */
               "Freeciv",                  /* application class name */



[Prev in Thread] Current Thread [Next in Thread]