]> The Tcpdump Group git mirrors - libpcap/commitdiff
Ignore the return value of strerror_r().
authorGuy Harris <[email protected]>
Tue, 14 Nov 2017 05:19:51 +0000 (21:19 -0800)
committerGuy Harris <[email protected]>
Tue, 14 Nov 2017 05:19:51 +0000 (21:19 -0800)
If it fails, it either means 1) the buffer was too short, but it
provided a truncated message, and we're not going to allocate a bigger
buffer to make it work, or 2) the errno doesn't have a string
corresponding to it, but it provided a message of some sort for the
error, even if it's just something like "Unknown error", and we're not
going to construct our own message.

rpcapd/daemon.c

index 8113fb8bc9352a15e1ddb62784247bab558817f0..8a47f384f71c706ef207e34488bb60dfbe6514f6 100755 (executable)
@@ -1753,7 +1753,7 @@ static int daemon_msg_startcap_req(struct daemon_slpars *pars, uint32 plen, int
        {
                char thread_errbuf[PCAP_ERRBUF_SIZE];
 
-               strerror_r(ret, thread_errbuf, PCAP_ERRBUF_SIZE);
+               (void)strerror_r(ret, thread_errbuf, PCAP_ERRBUF_SIZE);
                pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error creating the data thread: %s", thread_errbuf);
                pthread_attr_destroy(&detachedAttribute);
                goto error;
@@ -2239,14 +2239,14 @@ daemon_thrdatamain(void *ptr)
        retval = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
        if (retval != 0)
        {
-               strerror_r(retval, errbuf, PCAP_ERRBUF_SIZE);
+               (void)strerror_r(retval, errbuf, PCAP_ERRBUF_SIZE);
                rpcapd_log(LOGPRIO_ERROR,
                    "Can't set cancel state on data thread: %s", errbuf);
                goto error;
        }
        if (pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL))
        {
-               strerror_r(retval, errbuf, PCAP_ERRBUF_SIZE);
+               (void)strerror_r(retval, errbuf, PCAP_ERRBUF_SIZE);
                rpcapd_log(LOGPRIO_ERROR,
                    "Can't set cancel type on data thread: %s", errbuf);
                goto error;