summaryrefslogtreecommitdiff
path: root/sbin/ipnat/ipnat.c
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>1997-06-17 10:42:09 +0000
committerNiels Provos <provos@cvs.openbsd.org>1997-06-17 10:42:09 +0000
commit756200b35a82da5cf261e44482d92c2054bd2f30 (patch)
treee215474ed7f300ed2d5c322f05e4f479b29851ee /sbin/ipnat/ipnat.c
parent365969275a79b894825b773c7f939252e77cde16 (diff)
dont coredump if the specified rule file does not exist
Diffstat (limited to 'sbin/ipnat/ipnat.c')
-rw-r--r--sbin/ipnat/ipnat.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sbin/ipnat/ipnat.c b/sbin/ipnat/ipnat.c
index de26edd820d..182348e8d30 100644
--- a/sbin/ipnat/ipnat.c
+++ b/sbin/ipnat/ipnat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipnat.c,v 1.13 1997/02/14 11:02:05 niklas Exp $ */
+/* $OpenBSD: ipnat.c,v 1.14 1997/06/17 10:42:08 provos Exp $ */
/*
* (C)opyright 1993,1994,1995 by Darren Reed.
*
@@ -704,9 +704,12 @@ int opts;
FILE *fp;
int linenum = 1;
- if (strcmp(file, "-"))
- fp = fopen(file, "r");
- else
+ if (strcmp(file, "-")) {
+ if ((fp = fopen(file, "r")) == NULL) {
+ perror("fopen");
+ exit(-1);
+ }
+ } else
fp = stdin;
while (fgets(line, sizeof(line) - 1, fp)) {