summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2016-12-15 15:01:05 +0200
committerPanu Matilainen <pmatilai@redhat.com>2016-12-15 15:05:08 +0200
commit120229d73ae95dc7d63dc5e206e39cd52603112c (patch)
tree508a046c267867836bcc8d95bc6072745f2f5b11
parentc5f82d3f6223ebd0c5cc0a07ea60393ae7284929 (diff)
downloadrpm-120229d73ae95dc7d63dc5e206e39cd52603112c.tar.gz
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.
-rw-r--r--rpmio/rpmsq.c12
1 files 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;