From: Guy Harris Date: Sat, 19 Jan 2019 02:09:54 +0000 (-0800) Subject: Use pthread_sigmask() rather than sigprocmask(). X-Git-Tag: libpcap-1.10-bp~608 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/c2f0bb03a1ee5d949b0d97cede3dcb89c8ac949f Use pthread_sigmask() rather than sigprocmask(). The Single UNIX Specification says you should use pthread_sigmask(), not sigprocmask(), in multithreaded programs, and rpcapd is a multithreaded program. --- diff --git a/rpcapd/daemon.c b/rpcapd/daemon.c index 368ca638..ab07117e 100644 --- a/rpcapd/daemon.c +++ b/rpcapd/daemon.c @@ -2467,7 +2467,7 @@ daemon_thrdatamain(void *ptr) // sigemptyset(&sigusr1); sigaddset(&sigusr1, SIGUSR1); - sigprocmask(SIG_BLOCK, &sigusr1, NULL); + pthread_sigmask(SIG_BLOCK, &sigusr1, NULL); #endif // Retrieve the packets @@ -2477,14 +2477,14 @@ daemon_thrdatamain(void *ptr) // // Unblock SIGUSR1 while we might be waiting for packets. // - sigprocmask(SIG_UNBLOCK, &sigusr1, NULL); + pthread_sigmask(SIG_UNBLOCK, &sigusr1, NULL); #endif retval = pcap_next_ex(session->fp, &pkt_header, (const u_char **) &pkt_data); // cast to avoid a compiler warning #ifndef _WIN32 // // Now block it again. // - sigprocmask(SIG_BLOCK, &sigusr1, NULL); + pthread_sigmask(SIG_BLOCK, &sigusr1, NULL); #endif if (retval < 0) break; // error