summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorEric Jackson <ericj@cvs.openbsd.org>2002-03-26 02:22:42 +0000
committerEric Jackson <ericj@cvs.openbsd.org>2002-03-26 02:22:42 +0000
commit147a9f49bb30bf966af6ed1f434b5994380eea79 (patch)
tree4da252b6575919dea41a76d42f2526a895bb7dd2 /usr.sbin
parent036922e5f3a0c117f3e547e9416f248c5504acae (diff)
check that the fopen didnt fail
deraadt@ OK
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ypserv/stdhosts/stdhosts.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/usr.sbin/ypserv/stdhosts/stdhosts.c b/usr.sbin/ypserv/stdhosts/stdhosts.c
index 044640c7ccf..41b3c686d0b 100644
--- a/usr.sbin/ypserv/stdhosts/stdhosts.c
+++ b/usr.sbin/ypserv/stdhosts/stdhosts.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: stdhosts.c,v 1.5 2001/11/19 09:01:29 deraadt Exp $ */
+/* $OpenBSD: stdhosts.c,v 1.6 2002/03/26 02:22:41 ericj Exp $ */
/*
* Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se>
@@ -32,7 +32,7 @@
*/
#ifndef LINT
-static char rcsid[] = "$OpenBSD: stdhosts.c,v 1.5 2001/11/19 09:01:29 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: stdhosts.c,v 1.6 2002/03/26 02:22:41 ericj Exp $";
#endif
#include <sys/types.h>
@@ -82,22 +82,19 @@ main(argc, argv)
{
FILE *data_file;
char data_line[1024];
- int usage = 0;
int line_no = 0;
int len;
char *p, *k, *v;
struct in_addr host_addr;
- if (argc > 2)
- usage++;
-
- if (usage) {
+ if (argc > 2) {
fprintf(stderr, "usage: stdhosts [file]\n");
exit(1);
}
if (argc == 2)
- data_file = fopen(argv[argc-1], "r");
+ if ((data_file = fopen(argv[argc-1], "r")) == NULL)
+ err(1, "");
else
data_file = stdin;