From: claudio Date: Fri, 17 Nov 2023 12:10:23 +0000 (+0000) Subject: Do not log errors form pcap_dispatch() caused by signals. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e75e148f81511fc8f6c2989297fd5c942483fb7a;p=openbsd Do not log errors form pcap_dispatch() caused by signals. pcap_dispatch() returns -1 (PCAP_ERROR) or -2 (PCAP_ERROR_BREAK) the latter is used when a signal is received and is not an error. So limit the code to log errors to np == -1. OK semarie@ sashan@ --- diff --git a/sbin/pflogd/pflogd.c b/sbin/pflogd/pflogd.c index 271e46326ee..ad4230c72ea 100644 --- a/sbin/pflogd/pflogd.c +++ b/sbin/pflogd/pflogd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pflogd.c,v 1.65 2023/11/12 15:18:04 dlg Exp $ */ +/* $OpenBSD: pflogd.c,v 1.66 2023/11/17 12:10:23 claudio Exp $ */ /* * Copyright (c) 2001 Theo de Raadt @@ -725,7 +725,7 @@ main(int argc, char **argv) while (1) { np = pcap_dispatch(hpcap, PCAP_NUM_PKTS, phandler, (u_char *)dpcap); - if (np < 0) { + if (np == -1) { if (!if_exists(interface)) { logmsg(LOG_NOTICE, "interface %s went away", interface);