]> The Tcpdump Group git mirrors - libpcap/commitdiff
Use pthread_sigmask() rather than sigprocmask().
authorGuy Harris <[email protected]>
Sat, 19 Jan 2019 02:09:54 +0000 (18:09 -0800)
committerGuy Harris <[email protected]>
Sat, 19 Jan 2019 02:09:54 +0000 (18:09 -0800)
The Single UNIX Specification says you should use pthread_sigmask(), not
sigprocmask(), in multithreaded programs, and rpcapd is a multithreaded
program.

rpcapd/daemon.c

index 368ca638ca7418f2e05c5aaea035d2eda45710ab..ab07117eb517acf0679abbb9267828137e820cdb 100644 (file)
@@ -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