Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > f48a5cd9ad8f17ad8b10b2d4229901f6 > files > 51

cman-2.0.115-109.el5_9.4.src.rpm

From 70fc37ef432d6ec209f64c65f7d2671d86063387 Mon Sep 17 00:00:00 2001
From: Lon Hohberger <lhh@redhat.com>
Date: Thu, 29 Jul 2010 15:53:59 -0400
Subject: [PATCH 3/3] ccsd: Add error when bind fails

Resolves: rhbz#573996

Signed-off-by: Lon Hohberger <lhh@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
 ccs/daemon/cluster_mgr.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/ccs/daemon/cluster_mgr.c b/ccs/daemon/cluster_mgr.c
index 7cfa531..627dc5b 100644
--- a/ccs/daemon/cluster_mgr.c
+++ b/ccs/daemon/cluster_mgr.c
@@ -364,6 +364,7 @@ static int handle_cluster_event(cman_handle_t handle)
 
 static void cluster_communicator(void)
 {
+  char addrbuf[64], *res;
   int ccsd_fd = -1;
   int cman_fd = -1;
   int warn_user = 0;
@@ -398,7 +399,12 @@ static void cluster_communicator(void)
   fcntl(ccsd_fd, F_SETFD, flags);
 
   if (bind(ccsd_fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
-    log_err("Unable to bind to socket.\n");
+    res = inet_ntop(AF_INET,&sin.sin_addr, addrbuf, sizeof(addrbuf));
+    if (res) {
+      log_sys_err("Unable to bind socket addr: %s, port: %d, proto: %d", addrbuf, ntohs(sin.sin_port), sin.sin_family);
+    } else {
+      log_sys_err("Unable to bind to ipv4 socket, but inet_ntop returned NULL pointer");
+    }
     close(ccsd_fd);
     exit(EXIT_FAILURE);
   }
-- 
1.7.2.3