Gitweb:
http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=23bae572bfe...
Commit: 23bae572bfed8abde2f03b878505e511ae92a43a
Parent: 04d4a74883ae3e33ceafd72c03f09eb5e75a33a5
Author: Christine Caulfield <ccaulfie(a)redhat.com>
AuthorDate: Fri Nov 20 15:48:26 2015 +0000
Committer: Christine Caulfield <ccaulfie(a)redhat.com>
CommitterDate: Fri Nov 20 15:48:26 2015 +0000
libcman: Don't segfault if /dev/zero doesn't exist
Patch taken from stable32 branch
rhbz#1171241#1171241#1171241
Signed-off-by: Christine Caulfield <ccaulfie(a)redhat.com>
---
cman/lib/libcman.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/cman/lib/libcman.c b/cman/lib/libcman.c
index a99f5a0..1954468 100644
--- a/cman/lib/libcman.c
+++ b/cman/lib/libcman.c
@@ -303,7 +303,7 @@ static cman_handle_t open_socket(const char *name, int namelen, void
*privdata)
return NULL;
}
- fcntl(h->fd, F_SETFD, 1); /* Set close-on-exec */
+ fcntl(h->fd, F_SETFD, FD_CLOEXEC);
memset(&sockaddr, 0, sizeof(sockaddr));
memcpy(sockaddr.sun_path, name, namelen);
sockaddr.sun_family = AF_UNIX;
@@ -328,7 +328,10 @@ static cman_handle_t open_socket(const char *name, int namelen, void
*privdata)
h = NULL;
errno = saved_errno;
}
- fcntl(h->zero_fd, F_SETFD, 1); /* Set close-on-exec */
+ else
+ {
+ fcntl(h->zero_fd, F_SETFD, FD_CLOEXEC);
+ }
return (cman_handle_t)h;
}