diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-07-10 14:57:41 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-07-10 14:57:41 -0700 |
commit | d88030a659a15134923a97144432169c66d197fd (patch) | |
tree | 16140e90845f116d690f4b1ec819a53ef23e5e12 /pcap-linux.c | |
parent | fbb17b57d379a5963b6e8b67f41a5d13eb8a85a2 (diff) |
Cast away return values if we're not checking them.
When destroying a ring buffer, there's not much we can do if the call to
destroy the ring buffer fails, so we just ignore the return value of
setsockopt(); cast it to void, to explicitly indicate that we're
ignoring it, in the hopes that Coverity will no longer complain that
we're ignoring it. Add a comment noting this.
Do the same with the return value of munmap(), as we're ignoring it for
the same reason (even though Coverity, for some unknown reason, didn't
complain about it).
Diffstat (limited to 'pcap-linux.c')
-rw-r--r-- | pcap-linux.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pcap-linux.c b/pcap-linux.c index 48749c18..5d894d05 100644 --- a/pcap-linux.c +++ b/pcap-linux.c @@ -3949,13 +3949,14 @@ destroy_ring(pcap_t *handle) /* tell the kernel to destroy the ring*/ struct tpacket_req req; memset(&req, 0, sizeof(req)); - setsockopt(handle->fd, SOL_PACKET, PACKET_RX_RING, + /* do not test for setsockopt failure, as we can't recover from any error */ + (void)setsockopt(handle->fd, SOL_PACKET, PACKET_RX_RING, (void *) &req, sizeof(req)); /* if ring is mapped, unmap it*/ if (handlep->mmapbuf) { /* do not test for mmap failure, as we can't recover from any error */ - munmap(handlep->mmapbuf, handlep->mmapbuflen); + (void)munmap(handlep->mmapbuf, handlep->mmapbuflen); handlep->mmapbuf = NULL; } } |