Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

game crashes on failed XOpenDisplay (patch)



Hi!

Crossfire would crash when failing to open a display, e g when someone
has forgotten to do xhost +.

Here's a patch to change to the intended behavior, apply to xio.c.

                // Magnus


*** crossfire-0.88.4.orig/xio.c Wed Jan 20 02:05:16 1993
--- crossfire-0.88.4.etek/xio.c Sun Jan 24 23:12:36 1993
***************
*** 222,227 ****
--- 222,232 ----
  
    p->gdisp=XOpenDisplay(display);
  
+   if(!p->gdisp) {
+     sprintf(errmsg,"Can't open display %s.",display);
+     return 1;
+   }
+ 
    if((cp=XGetDefault(p->gdisp,"crossfire","splitwindow"))!=NULL)
      if(!strcmp("on",cp)||!strcmp("yes",cp))
        p->split_window=1;
***************
*** 230,239 ****
  
    setuid(olduid);             /* Back to owner of suid crossfire */
  
-   if(!p->gdisp) {
-     sprintf(errmsg,"Can't open display %s.",display);
-     return 1;
-   }
  /*
    XAutoRepeatOff(p->gdisp);
  */
--- 235,240 ----