cluster: RHEL6 - rgmanager: Make clufindhostname -i predictable

Lon Hohberger lon at fedoraproject.org
Mon Jan 31 22:54:25 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=c9ff58e8282948fa92bb82c05d40858a22ac61e6
Commit:        c9ff58e8282948fa92bb82c05d40858a22ac61e6
Parent:        e82577d4784d1ef9748ae8e932d7445c3337d761
Author:        Lon Hohberger <lhh at redhat.com>
AuthorDate:    Thu Dec 9 16:01:27 2010 -0500
Committer:     Lon Hohberger <lhh at redhat.com>
CommitterDate: Mon Jan 31 17:48:18 2011 -0500

rgmanager: Make clufindhostname -i predictable

Resolves: rhbz#661881

Signed-off-by: Lon Hohberger <lhh at redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto at redhat.com>
---
 rgmanager/src/utils/clufindhostname.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/rgmanager/src/utils/clufindhostname.c b/rgmanager/src/utils/clufindhostname.c
index 42e1691..f8bf7fd 100644
--- a/rgmanager/src/utils/clufindhostname.c
+++ b/rgmanager/src/utils/clufindhostname.c
@@ -24,7 +24,7 @@ main(int argc, char **argv)
 	void *ptr;
 	struct in_addr  addr4;
 	struct in6_addr addr6;
-	int opt, size, family;
+	int opt, size, family, ret;
 	char *sep;
 
 	if (argc != 3) {
@@ -47,8 +47,10 @@ main(int argc, char **argv)
 				size = sizeof(addr6);
 			}
 
-			if (inet_pton(family, optarg, ptr) < 0) {
-				perror("inet_pton");
+			ret = inet_pton(family, optarg, ptr);
+			if (ret <= 0) {
+				if (ret < 0)
+					perror("inet_pton");
 				exit(2);
 			}
 


More information about the cluster-commits mailing list