diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-02-22 12:24:24 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-02-22 12:24:24 -0800 |
commit | 27593e4b8d1debe7046a383fa3e43fd35fa27119 (patch) | |
tree | 3aa5cf5456a88e3865af629124bf1f564c7492e0 /pcap.c | |
parent | 32d01a544d12ae31a093719796c62630db3ad291 (diff) |
Clean up pcap_do_addexit() and calls to it.
atexit() is only specified in standards as returning "a non-zero value"
on error; don't assume it returns -1, even if it's documented as doing
so on some platforms.
pcap_do_addexit() already fills in p->errbuf; don't do so in its callers.
Diffstat (limited to 'pcap.c')
-rw-r--r-- | pcap.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -1922,12 +1922,11 @@ pcap_do_addexit(pcap_t *p) * "pcap_close_all()" called when we exit. */ if (!did_atexit) { - if (atexit(pcap_close_all) == -1) { + if (atexit(pcap_close_all) != 0) { /* * "atexit()" failed; let our caller know. */ - strncpy(p->errbuf, "atexit failed", - PCAP_ERRBUF_SIZE); + strlcpy(p->errbuf, "atexit failed", PCAP_ERRBUF_SIZE); return (0); } did_atexit = 1; |