From 76deddc206b72ecfe50ddc6a7f4ee4ea126c25f4 Mon Sep 17 00:00:00 2001 From: Daniel Hartmeier Date: Thu, 27 Mar 2003 20:21:35 +0000 Subject: minor tweaks from Andrey Matveev, ok henning@ and cedric@ --- sbin/pfctl/pfctl.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'sbin/pfctl/pfctl.c') diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 785c0f83c6e..0d534e21a46 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl.c,v 1.162 2003/03/27 18:01:57 henning Exp $ */ +/* $OpenBSD: pfctl.c,v 1.163 2003/03/27 20:21:34 dhartmei Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -429,7 +429,7 @@ pfctl_kill_states(int dev, int opts) ((struct sockaddr_in6 *)resp[0]->ai_addr)-> sin6_addr; else - errx(1, "Unknown address family!?!?!"); + errx(1, "Unknown address family %d", psk.psk_af); if (state_killers > 1) { dests = 0; @@ -464,7 +464,8 @@ pfctl_kill_states(int dev, int opts) ((struct sockaddr_in6 *)resp[1]-> ai_addr)->sin6_addr; else - errx(1, "Unknown address family!?!?!"); + errx(1, "Unknown address family %d", + psk.psk_af); if (ioctl(dev, DIOCKILLSTATES, &psk)) err(1, "DIOCKILLSTATES"); @@ -979,13 +980,12 @@ pfctl_rules(int dev, char *filename, int opts) fin = stdin; infile = "stdin"; } else { - fin = fopen(filename, "r"); + if ((fin = fopen(filename, "r")) == NULL) { + warn("%s", filename); + return (1); + } infile = filename; } - if (fin == NULL) { - warn("%s", filename); - return (1); - } if ((opts & PF_OPT_NOACTION) == 0) { if ((loadopt & (PFCTL_FLAG_NAT | PFCTL_FLAG_ALL)) != 0) { pr[PF_RULESET_NAT].rule.action = PF_NAT; @@ -1024,7 +1024,7 @@ pfctl_rules(int dev, char *filename, int opts) } pf.rule_nr = 0; if (parse_rules(fin, &pf) < 0) - errx(1, "Syntax error in file: pf rules not loaded"); + errx(1, "Syntax error in config file: pf rules not loaded"); if ((altqsupport && (loadopt & (PFCTL_FLAG_ALTQ | PFCTL_FLAG_ALL)) != 0)) if (check_commit_altq(dev, opts) != 0) errx(1, "errors in altq config"); -- cgit v1.2.3