`pfctl -a foo' exits 0; "foo" does not exist.

Let's implement what's acutally documented:

        -a anchor
                Apply flags -f, -F, and -s only to the rules in the specified
                anchor.

Suggestions for a better warning?
OK?

Index: pfctl.c
===================================================================
RCS file: /cvs/src/sbin/pfctl/pfctl.c,v
retrieving revision 1.357
diff -u -p -r1.357 pfctl.c
--- pfctl.c     7 Sep 2018 19:56:07 -0000       1.357
+++ pfctl.c     8 Sep 2018 09:44:42 -0000
@@ -2500,6 +2500,10 @@ main(int argc, char *argv[])
                errx(1, "pfctl: calloc");
        memset(anchorname, 0, sizeof(anchorname));
        if (anchoropt != NULL) {
+               if (rulesopt == NULL && clearopt == NULL && showopt == NULL) {
+                       warnx("missing -f, -F or -s");
+                       usage();
+               }
                int len = strlen(anchoropt);
 
                if (anchoropt[len - 1] == '*') {

Reply via email to