Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!kddlab!titcca!sragwa!wsgw!hay3!hayashi From: hayashi@ws.sony.junet (Kazunori Hayashi) Newsgroups: comp.sources.games.bugs Subject: Re: Lunar Lander Message-ID: <25481@wsgw.ws.sony.junet> Date: 4 Jun 89 07:56:45 GMT References: <107518@sun.Eng.Sun.COM> <2042@deimos.cis.ksu.edu> <1571@wjvax.UUCP> Sender: news@ws.sony.junet Lines: 73 I found minor BUG in Lunar Lander. In the source, it tries to open the score file two times at a time. So, open file count will increase by one, every time you try to write the score file. It may cause EMFILE (Too many open file) to continue playing this game. But I've never tried, because, in our system, max open file count is 64. void ScWrite(back_win) WINDOW *back_win; { int items; FILE *fp; char *user; score_t score_pad[HS_ENTRIES + 1]; void qsort(); char *getenv(); if (Score == 0) return; *1 if ((fp = fopen(HSFile, "r")) == NULL) { ScDisplayErr(back_win, "Unable to read HS file."); ScDisplayErr(back_win, "Attempting to create HS file."); if (creat(HSFile, 0777) == -1) { ScDisplayErr(back_win, "Unable to create HS file, check pathname."); return; } } *2 if ((fp = fopen(HSFile, "r")) == NULL) { ScDisplayErr(back_win, "Unable to read new HS file."); return; } items = fread((char *)score_pad, sizeof(score_t), HS_ENTRIES, fp); *1 fclose(fp); +++++++++ This shoud be if ((fp = fopen(HSFile, "r")) == NULL) { ScDisplayErr(back_win, "Unable to read HS file."); ScDisplayErr(back_win, "Attempting to create HS file."); if (creat(HSFile, 0777) == -1) { ScDisplayErr(back_win, "Unable to create HS file, check pathname."); return; } ! if ((fp = fopen(HSFile, "r")) == NULL) ! { ! ScDisplayErr(back_win, "Unable to read new HS file."); ! return; ! } } items = fread((char *)score_pad, sizeof(score_t), HS_ENTRIES, fp); fclose(fp); === Kazunori Hayashi Workstation Div. Supermicro Systems Group Sony Corporation 6-7-35, Kitashinagawa Shinagawa-ku, Tokyo, 141 Japan hayashi@ws.sony.junet tel: 03-448-4015 fax: 03-448-4216