diff options
author | Daniel Hartmeier <dhartmei@cvs.openbsd.org> | 2003-08-04 17:29:45 +0000 |
---|---|---|
committer | Daniel Hartmeier <dhartmei@cvs.openbsd.org> | 2003-08-04 17:29:45 +0000 |
commit | ba654d3f3ba30bdc247f39b1bb74fb11280a2010 (patch) | |
tree | 62f7f6f2cd7a8d2d7795db17044af78f7d7a6c8e | |
parent | 0185b18c9832239d0f592122ceae728b86d3733b (diff) |
Not every suggested patch is perfect :)
ERRX() has two effects: the message printing and goto _error; which causes
exit(1). While we don't want the message if pfctl was invoked with -n, we
DO want to abort. Otherwise subsequent 'load anchor' statements will get
executed, for instance, and the return value is handy for scripts.
-rw-r--r-- | sbin/pfctl/pfctl.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 56f69e942ff..6bf234b9f64 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl.c,v 1.184 2003/08/04 12:17:01 henning Exp $ */ +/* $OpenBSD: pfctl.c,v 1.185 2003/08/04 17:29:44 dhartmei Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -987,8 +987,13 @@ pfctl_rules(int dev, char *filename, int opts, char *anchorname, pf.rule_nr = 0; pf.anchor = anchorname; pf.ruleset = rulesetname; - if ((parse_rules(fin, &pf) < 0) && ((opts & PF_OPT_NOACTION) == 0)) - ERRX("Syntax error in config file: pf rules not loaded"); + if (parse_rules(fin, &pf) < 0) { + if ((opts & PF_OPT_NOACTION) == 0) + ERRX("Syntax error in config file: " + "pf rules not loaded"); + else + goto _error; + } if ((altqsupport && (loadopt & PFCTL_FLAG_ALTQ) != 0)) if (check_commit_altq(dev, opts) != 0) ERRX("errors in altq config"); |