From nobody  Mon Dec  1 19:00:59 1997
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.7/8.8.7) id TAA18188;
          Mon, 1 Dec 1997 19:00:59 -0800 (PST)
          (envelope-from nobody)
Message-Id: <199712020300.TAA18188@hub.freebsd.org>
Date: Mon, 1 Dec 1997 19:00:59 -0800 (PST)
From: garbanzo@hooked.net
To: freebsd-gnats-submit@freebsd.org
Subject: phantasia will segfault if it can't open certian files
X-Send-Pr-Version: www-1.0

>Number:         5187
>Category:       misc
>Synopsis:       phantasia will segfault if it can't open certian files
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    steve
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec  1 19:10:01 PST 1997
>Closed-Date:    Tue Jan 6 16:52:59 PST 1998
>Last-Modified:  Tue Jan  6 16:54:15 PST 1998
>Originator:     Alex
>Release:        3.0-current
>Organization:
>Environment:
FreeBSD zippy.dyn.ml.org 3.0-CURRENT FreeBSD 3.0-CURRENT #0:
Mon Dec  1 00:29:42 PST 1997     root@zippy.dyn.ml.org:/usr/src/sys/compile/ZIPPY  i386

>Description:
When phantasia is run, it expects to have access to various
/var/games/phantasia files, if it doesn't it calls a function
to theoretically shut itself down nicely.  However that function
doesn't check to see if the fds it's fclosing are open or not.	
>How-To-Repeat:
Run phantasia as a user that doesn't have read or write
access to /var/games.
>Fix:
*** main.c.orig Mon Dec  1 18:59:03 1997
--- main.c      Mon Dec  1 18:59:32 1997
***************
*** 1277,1286 ****
        endwin();
        }
  
!     fclose(Playersfp);
!     fclose(Monstfp);
!     fclose(Messagefp);
!     fclose(Energyvoidfp);
  
      if (doexit)
        exit(0);
--- 1277,1290 ----
        endwin();
        }
  
!     if (Playersfp)
!       fclose(Playersfp);
!     if (Monstfp)
!       fclose(Monstfp);
!     if (Messagefp)
!       fclose(Messagefp);
!     if (Energyvoidfp)
!       fclose(Energyvoidfp);
  
      if (doexit)
        exit(0);
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: steve 
State-Changed-When: Tue Jan 6 16:52:59 PST 1998 
State-Changed-Why:  
Fixed by imp@FreeBSD.org in revision 1.5 of main.c. 
>Unformatted:
