diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-11-15 10:47:24 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-11-15 10:47:24 -0800 |
commit | 7d787482040aa327ef2345eca2e9f980ce76cc28 (patch) | |
tree | a4756446c343f763ab12c0c55b78801d3c28a3f4 /pcap-tc.c | |
parent | 3299e855cb1cf7b6426d70e52cc51a022b9d9141 (diff) |
Add a routine to format error messages with an errno-based message at the end.
That routine will use strerror_s() or strerror_r() if available, in a
fashion that's thread-safe. Otherwise, it falls back on
pcap_strerror().
Use it in both libpcap and rpcapd.
Given that we check for errors in strerror_r(), hopefully this will
squelch warnings with newer version of GCC and GNU libc; whilst the
macOS (and other BSD-flavored?) strerror_r() always fills in a message,
that's not required by the Single UNIX Specification, as far as I can
tell, so we apparently really *do* need to check for errors.
Diffstat (limited to 'pcap-tc.c')
-rw-r--r-- | pcap-tc.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1130,8 +1130,8 @@ TcSetFilter(pcap_t *p, struct bpf_program *fp) /* Install a user level filter */ if (install_bpf_program(p, fp) < 0) { - pcap_snprintf(p->errbuf, sizeof(p->errbuf), - "setfilter, unable to install the filter: %s", pcap_strerror(errno)); + pcap_fmt_errmsg_for_errno(p->errbuf, sizeof(p->errbuf), + errno, "setfilter, unable to install the filter"); return -1; } |