Subject: bin/7664: minor glitch in wall(1)
To: None <gnats-bugs@gnats.netbsd.org>
From: David Holland <dholland@eecs.harvard.edu>
List: netbsd-bugs
Date: 05/29/1999 14:22:46
>Number: 7664
>Category: bin
>Synopsis: wrong error handling for mkstemp in usr.bin/wall
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat May 29 14:05:00 1999
>Last-Modified:
>Originator: <dholland@eecs.harvard.edu>
>Organization:
- David A. Holland | VINO project home page:
dholland@eecs.harvard.edu | http://www.eecs.harvard.edu/vino
>Release: NetBSD-current of 1990529
>Environment:
This is in the source of today's -current.
>Description:
mkstemp is checked for a zero return value rather than -1.
>How-To-Repeat:
N/A.
>Fix:
Apply:
--- wall.c.orig Sat May 29 16:41:39 1999
+++ wall.c Sat May 29 16:42:14 1999
@@ -142,7 +142,7 @@
char *p, hostname[MAXHOSTNAMELEN+1], lbuf[100], tmpname[15];
(void)snprintf(tmpname, sizeof tmpname, "%s/wall.XXXXXX", _PATH_TMP);
- if (!(fd = mkstemp(tmpname)) || !(fp = fdopen(fd, "r+")))
+ if ((fd = mkstemp(tmpname))<0 || (fp = fdopen(fd, "r+"))==NULL)
err(1, "can't open temporary file");
(void)unlink(tmpname);
>Audit-Trail:
>Unformatted: