From owner-freebsd-bugs Mon Jun 5 15:30:14 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id DF70037B7D8 for ; Mon, 5 Jun 2000 15:30:00 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id PAA04133; Mon, 5 Jun 2000 15:30:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 49D5837B7D8 for ; Mon, 5 Jun 2000 15:23:12 -0700 (PDT) (envelope-from dwmalone@maths.tcd.ie) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 5 Jun 2000 23:23:11 +0100 (BST) Message-Id: <200006052323.aa63052@walton.maths.tcd.ie> Date: Mon, 5 Jun 2000 23:23:11 +0100 (BST) From: dwmalone@maths.tcd.ie Reply-To: dwmalone@maths.tcd.ie To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/19044: Some games compare initscr() to ERR. Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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