From 120229d73ae95dc7d63dc5e206e39cd52603112c Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 15 Dec 2016 15:01:05 +0200 Subject: Replace sigprocmask() uses with pthread_sigmask() We're not exactly thread-safe anywhere but lets at least use the variant whose behavior is not decidedly undefined in a threaded environment. --- rpmio/rpmsq.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rpmio/rpmsq.c b/rpmio/rpmsq.c index 6dacd77bf..f4d8a8712 100644 --- a/rpmio/rpmsq.c +++ b/rpmio/rpmsq.c @@ -101,7 +101,7 @@ int rpmsqActivate(int state) return 0; (void) sigfillset(&newMask); - (void) sigprocmask(SIG_BLOCK, &newMask, &oldMask); + (void) pthread_sigmask(SIG_BLOCK, &newMask, &oldMask); if (state) { struct sigaction sa; @@ -131,7 +131,7 @@ int rpmsqActivate(int state) } } } - sigprocmask(SIG_SETMASK, &oldMask, NULL); + pthread_sigmask(SIG_SETMASK, &oldMask, NULL); return 0; } @@ -142,7 +142,7 @@ int rpmsqPoll(void) /* block all signals while processing the queue */ (void) sigfillset(&newMask); - (void) sigprocmask(SIG_BLOCK, &newMask, &oldMask); + (void) pthread_sigmask(SIG_BLOCK, &newMask, &oldMask); for (rpmsig tbl = rpmsigTbl; tbl->signum >= 0; tbl++) { /* honor blocked signals in polling too */ @@ -158,7 +158,7 @@ int rpmsqPoll(void) n++; } } - sigprocmask(SIG_SETMASK, &oldMask, NULL); + pthread_sigmask(SIG_SETMASK, &oldMask, NULL); return n; } @@ -173,12 +173,12 @@ int rpmsqBlock(int op) blocked++; if (blocked == 1) { sigfillset(&newMask); - ret = sigprocmask(SIG_BLOCK, &newMask, &oldMask); + ret = pthread_sigmask(SIG_BLOCK, &newMask, &oldMask); } } else if (op == SIG_UNBLOCK) { blocked--; if (blocked == 0) { - ret = sigprocmask(SIG_SETMASK, &oldMask, NULL); + ret = pthread_sigmask(SIG_SETMASK, &oldMask, NULL); rpmsqPoll(); } else if (blocked < 0) { blocked = 0; -- cgit v1.2.1