summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Privoznik <mprivozn@redhat.com>2014-03-19 18:10:34 +0100
committerEric Blake <eblake@redhat.com>2014-03-19 22:27:47 -0600
commit892107de19b7fc67f8bf14053060c207902c6069 (patch)
tree94d1b77058e97e824fa0542404d47516f8a2c999
parentebc7e55ce847f40cf007f5ae02629ac5f1ebae80 (diff)
downloadlibvirt-892107de19b7fc67f8bf14053060c207902c6069.tar.gz
virNetClientSetTLSSession: Restore original signal mask
Currently, we use pthread_sigmask(SIG_BLOCK, ...) prior to calling poll(). This is okay, as we don't want poll() to be interrupted. However, then - immediately as we fall out from the poll() - we try to restore the original sigmask - again using SIG_BLOCK. But as the man page says, SIG_BLOCK adds signals to the signal mask: SIG_BLOCK The set of blocked signals is the union of the current set and the set argument. Therefore, when restoring the original mask, we need to completely overwrite the one we set earlier and hence we should be using: SIG_SETMASK The set of blocked signals is set to the argument set. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> (cherry picked from commit 3d4b4f5ac634c123af1981084add29d3a2ca6ab0)
-rw-r--r--src/rpc/virnetclient.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index bfa1624503..661048efc2 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -787,7 +787,7 @@ int virNetClientSetTLSSession(virNetClientPtr client,
if (ret < 0 && (errno == EAGAIN || errno == EINTR))
goto repoll;
- ignore_value(pthread_sigmask(SIG_BLOCK, &oldmask, NULL));
+ ignore_value(pthread_sigmask(SIG_SETMASK, &oldmask, NULL));
}
ret = virNetTLSContextCheckCertificate(tls, client->tls);
@@ -811,7 +811,7 @@ int virNetClientSetTLSSession(virNetClientPtr client,
if (ret < 0 && (errno == EAGAIN || errno == EINTR))
goto repoll2;
- ignore_value(pthread_sigmask(SIG_BLOCK, &oldmask, NULL));
+ ignore_value(pthread_sigmask(SIG_SETMASK, &oldmask, NULL));
len = virNetTLSSessionRead(client->tls, buf, 1);
if (len < 0 && errno != ENOMSG) {