diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2007-06-04 13:55:25 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2007-06-04 13:55:25 +0000 |
commit | cc4e44748b6a845f1f2d35fc2fe8753cb8b89300 (patch) | |
tree | 74b13a54c296d71da091464a42f86a23de5752f1 /sbin | |
parent | f01b5a6048773d536a0d3ba8a82071c67e31c438 (diff) |
use warn() where warn() is intended, not err()
exit nonzero if the inetrface does not exist
From: tbert <bret.lambert@gmail.com>
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/pflogd/pflogd.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sbin/pflogd/pflogd.c b/sbin/pflogd/pflogd.c index 12aa5d2817c..9012a8dc925 100644 --- a/sbin/pflogd/pflogd.c +++ b/sbin/pflogd/pflogd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pflogd.c,v 1.42 2007/06/02 20:38:58 henning Exp $ */ +/* $OpenBSD: pflogd.c,v 1.43 2007/06/04 13:55:24 henning Exp $ */ /* * Copyright (c) 2001 Theo de Raadt @@ -554,11 +554,13 @@ int main(int argc, char **argv) { struct pcap_stat pstat; - int ch, np, Xflag = 0; + int ch, np, ret, Xflag = 0; pcap_handler phandler = dump_packet; const char *errstr = NULL; char *pidf = NULL; + ret = 0; + closefrom(STDERR_FILENO + 1); while ((ch = getopt(argc, argv, "Dxd:f:i:p:s:")) != -1) { @@ -603,7 +605,7 @@ main(int argc, char **argv) /* does interface exist */ if (if_exists(interface)) { - err(1, "Failed to initialize: %s", interface); + warn("Failed to initialize: %s", interface); logmsg(LOG_ERR, "Failed to initialize: %s", interface); logmsg(LOG_ERR, "Exiting, init failure"); exit(1); @@ -676,6 +678,7 @@ main(int argc, char **argv) if (if_exists(interface) == -1) { logmsg(LOG_NOTICE, "interface %s went away", interface); + ret = -1; break; } logmsg(LOG_NOTICE, "%s", pcap_geterr(hpcap)); @@ -719,5 +722,5 @@ main(int argc, char **argv) pcap_close(hpcap); if (!Debug) closelog(); - return (0); + return (ret); } |