Date: Mon, 5 Jun 2000 23:23:11 +0100 (BST) From: dwmalone@maths.tcd.ie To: FreeBSD-gnats-submit@freebsd.org Subject: bin/19044: Some games compare initscr() to ERR. Message-ID: <200006052323.aa63052@walton.maths.tcd.ie>
next in thread | raw e-mail | index | archive | help
>Number: 19044 >Category: bin >Synopsis: Some games compare initscr() to ERR. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jun 05 15:30:01 PDT 2000 >Closed-Date: >Last-Modified: >Originator: David Malone >Release: FreeBSD 3.4-STABLE i386 >Organization: School of Maths, Trinity College, Dublin, Ireland. >Environment: FreeBSD-{5,4,3} >Description: sail and battlestar compart initscr() to ERR to see if it has failed. According to the man page for initscr: Routines that return pointers always return NULL on error. initscr is supposed to return a WINDOW *, so I think it should be compared to NULL to check for an error. >How-To-Repeat: make battlestar or sail with warnings turned on. >Fix: cvs diff: Diffing battlestar Index: battlestar/fly.c =================================================================== RCS file: /cvs/FreeBSD-CVS/src/games/battlestar/fly.c,v retrieving revision 1.6 diff -u -r1.6 fly.c --- battlestar/fly.c 1999/11/30 03:48:36 1.6 +++ battlestar/fly.c 2000/06/05 22:03:25 @@ -73,7 +73,7 @@ void moveenemy(); destroyed = 0; - if(initscr() == ERR){ + if(initscr() == NULL){ puts("Whoops! No more memory..."); return(0); } cvs diff: Diffing sail Index: sail/player.h =================================================================== RCS file: /cvs/FreeBSD-CVS/src/games/sail/player.h,v retrieving revision 1.2 diff -u -r1.2 player.h --- sail/player.h 1998/04/27 04:26:56 1.2 +++ sail/player.h 2000/06/05 22:06:34 @@ -91,9 +91,9 @@ #define SLOT_R (SLOT_L+SLOT_X-1) #ifdef SIGTSTP -#define SCREENTEST() (initscr() != ERR && signal(SIGTSTP, SIG_DFL) != BADSIG && STAT_R < COLS && SCROLL_Y > 0) +#define SCREENTEST() (initscr() != NULL && signal(SIGTSTP, SIG_DFL) != BADSIG && STAT_R < COLS && SCROLL_Y > 0) #else -#define SCREENTEST() (initscr() != ERR && STAT_R < COLS && SCROLL_Y > 0) +#define SCREENTEST() (initscr() != NULL && STAT_R < COLS && SCROLL_Y > 0) #endif WINDOW *view_w; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200006052323.aa63052>