Gitweb:
http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=c40959bc96c...
Commit: c40959bc96cde293989296358ba06d09d6ee6d69
Parent: bd81c6f65aac30aaeb6d3eb129eab6ee3512d40c
Author: Christine Caulfield <ccaulfie(a)redhat.com>
AuthorDate: Mon Dec 17 10:17:37 2012 +0000
Committer: Christine Caulfield <ccaulfie(a)redhat.com>
CommitterDate: Mon Dec 17 10:17:37 2012 +0000
If corosync goes down/is shut down cman will return 0 from cman_dispatch and close the
socket. However, if a cman write operation is issued before this happens then SIGPIPE can
result from the writev() call to an open, but disconnected, FD.
This patch changes writev() to sendmg() so it can pass MSG_NOSIGNAL to the
system call and prevent SIGPIPEs from occurring.
Acked-By: Fabio M. Di Nitto <fdinitto(a)redhat.com>
Signed-off-by: Christine Caulfield <ccaulfie(a)redhat.com>
---
cman/lib/libcman.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/cman/lib/libcman.c b/cman/lib/libcman.c
index 6ed8ecb..367129c 100644
--- a/cman/lib/libcman.c
+++ b/cman/lib/libcman.c
@@ -204,10 +204,19 @@ static int loopy_writev(int fd, struct iovec *iovptr, size_t
iovlen)
{
size_t byte_cnt=0;
int len;
+ struct msghdr msg;
+
+ msg.msg_name = NULL;
+ msg.msg_namelen = 0;
+ msg.msg_control = NULL;
+ msg.msg_controllen = 0;
while (iovlen > 0)
{
- len = writev(fd, iovptr, iovlen);
+ msg.msg_iov = iovptr;
+ msg.msg_iovlen = iovlen;
+
+ len = sendmsg(fd, &msg, MSG_NOSIGNAL);
if (len <= 0)
return len;