Alexandr Nedvedicky <sas...@fastmail.net> writes:

> Hello,
>
> diff below seems to make empty log message go way.
> we have to check if sig_alrm fired here in pflogd:
>
> [...]
>
> I believe read at line 92 returns with EINTER, so we jump to
> line to 75. If ALARM fires the condition at line 79 is true,
> because pflogd's alarm handlers calls pcap_breakloop():
>
> 174 void
> 175 sig_alrm(int sig)
> 176 {
> 177         pcap_breakloop(hpcap);
> 178         gotsig_alrm = 1;
> 179 }
>
>
> this makes me thinking the one-liner below is the fix we want.
>
> regards
> sashan
>
> --------8<---------------8<---------------8<------------------8<--------
> diff --git a/sbin/pflogd/pflogd.c b/sbin/pflogd/pflogd.c
> index 271e46326ee..42ca066b7e7 100644
> --- a/sbin/pflogd/pflogd.c
> +++ b/sbin/pflogd/pflogd.c
> @@ -732,7 +732,8 @@ main(int argc, char **argv)
>                               ret = -1;
>                               break;
>                       }
> -                     logmsg(LOG_NOTICE, "%s", pcap_geterr(hpcap));
> +                     if (gotsig_alrm == 0)
> +                             logmsg(LOG_NOTICE, "%s", pcap_geterr(hpcap));
>               }
>  
>               if (gotsig_close)

Your description makes sense, and it fixes the empty log message.
ok semarie@

Thanks.
-- 
Sebastien Marie

Reply via email to