diff options
author | Daniel Hartmeier <dhartmei@cvs.openbsd.org> | 2001-10-01 14:38:35 +0000 |
---|---|---|
committer | Daniel Hartmeier <dhartmei@cvs.openbsd.org> | 2001-10-01 14:38:35 +0000 |
commit | a1b691669c2df8b85118035a2c870990dfb04656 (patch) | |
tree | aa1e6e5acc5cd96bdb9ed81a80792f58542cd791 /sbin/pfctl/pfctl.c | |
parent | 23f7cca1c742ab225ad22d34a7b51344a3656f2a (diff) |
Print error message when pfctl -N/-R can't open the specified file
(instead of failing silently). Found by niklas@.
Diffstat (limited to 'sbin/pfctl/pfctl.c')
-rw-r--r-- | sbin/pfctl/pfctl.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 89781540db8..7e31c88b19f 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl.c,v 1.41 2001/09/30 05:29:37 frantzen Exp $ */ +/* $OpenBSD: pfctl.c,v 1.42 2001/10/01 14:38:34 dhartmei Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -444,8 +444,10 @@ pfctl_rules(int dev, char *filename, int opts) fin = fopen(filename, "r"); infile = filename; } - if (fin == NULL) + if (fin == NULL) { + warn("%s", filename); return (1); + } if ((opts & PF_OPT_NOACTION) == 0) { if (ioctl(dev, DIOCBEGINRULES, &pr.ticket)) err(1, "DIOCBEGINRULES"); @@ -485,8 +487,10 @@ pfctl_nat(int dev, char *filename, int opts) fin = fopen(filename, "r"); infile = filename; } - if (fin == NULL) + if (fin == NULL) { + warn("%s", filename); return (1); + } if ((opts & PF_OPT_NOACTION) == 0) { if (ioctl(dev, DIOCBEGINNATS, &pn.ticket)) |