summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1999-05-30 08:21:16 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1999-05-30 08:21:16 +0000
commita7203f622b30eff3f67640d09e56d311bdefc14d (patch)
tree52ea5858a30b4954b1d8866651a0dc8264046c14 /usr.bin
parenta9145375d938c4426d115377feb3bc10d6d3feea (diff)
correct mkstemp() failure checking
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/rwall/rwall.c6
-rw-r--r--usr.bin/wall/wall.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/rwall/rwall.c b/usr.bin/rwall/rwall.c
index 26ef930cd75..8f016c97765 100644
--- a/usr.bin/rwall/rwall.c
+++ b/usr.bin/rwall/rwall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rwall.c,v 1.4 1998/12/16 01:29:37 deraadt Exp $ */
+/* $OpenBSD: rwall.c,v 1.5 1999/05/30 08:21:15 deraadt Exp $ */
/*
* Copyright (c) 1993 Christopher G. Demetriou
@@ -42,7 +42,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)wall.c 5.14 (Berkeley) 3/2/91";*/
-static char rcsid[] = "$OpenBSD: rwall.c,v 1.4 1998/12/16 01:29:37 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: rwall.c,v 1.5 1999/05/30 08:21:15 deraadt Exp $";
#endif /* not lint */
/*
@@ -127,7 +127,7 @@ makemsg(fname)
char *whom, hostname[MAXHOSTNAMELEN], lbuf[100], tmpname[64];
snprintf(tmpname, sizeof(tmpname), "%s/wall.XXXXXX", _PATH_TMP);
- if (!(fd = mkstemp(tmpname)) || !(fp = fdopen(fd, "r+"))) {
+ if ((fd = mkstemp(tmpname)) == -1 || !(fp = fdopen(fd, "r+"))) {
(void)fprintf(stderr, "wall: can't open temporary file.\n");
exit(1);
}
diff --git a/usr.bin/wall/wall.c b/usr.bin/wall/wall.c
index c7a4e52fde1..7fa8a4dadcf 100644
--- a/usr.bin/wall/wall.c
+++ b/usr.bin/wall/wall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wall.c,v 1.11 1999/05/24 22:35:49 d Exp $ */
+/* $OpenBSD: wall.c,v 1.12 1999/05/30 08:21:15 deraadt Exp $ */
/* $NetBSD: wall.c,v 1.6 1994/11/17 07:17:58 jtc Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)wall.c 8.2 (Berkeley) 11/16/93";
#endif
-static char rcsid[] = "$OpenBSD: wall.c,v 1.11 1999/05/24 22:35:49 d Exp $";
+static char rcsid[] = "$OpenBSD: wall.c,v 1.12 1999/05/30 08:21:15 deraadt Exp $";
#endif /* not lint */
/*
@@ -190,7 +190,7 @@ makemsg(fname)
char *ttynam;
snprintf(tmpname, sizeof(tmpname), "%s/wall.XXXXXX", _PATH_TMP);
- if (!(fd = mkstemp(tmpname)) || !(fp = fdopen(fd, "r+")))
+ if ((fd = mkstemp(tmpname)) == -1 || !(fp = fdopen(fd, "r+")))
errx(1, "can't open temporary file.\n");
(void)unlink(tmpname);