14f8ab
From 3528c4fb59ca4d3efda2cf0689b7549e449bb91b Mon Sep 17 00:00:00 2001
14f8ab
From: Rinku Kothiya <rkothiya@redhat.com>
14f8ab
Date: Fri, 14 Jun 2019 07:53:06 +0000
14f8ab
Subject: [PATCH 224/255] core: replace inet_addr with inet_pton
14f8ab
14f8ab
Fixes warning raised by RPMDiff on the use of inet_addr, which may
14f8ab
impact Ipv6 support
14f8ab
14f8ab
> upstream patch : https://review.gluster.org/#/c/glusterfs/+/22866/
14f8ab
14f8ab
>fixes: bz#1721385
14f8ab
>Change-Id: Id2d9afa1747efa64bc79d90dd2566bff54deedeb
14f8ab
>Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
14f8ab
14f8ab
BUG: 1698435
14f8ab
Change-Id: Id2d9afa1747efa64bc79d90dd2566bff54deedeb
14f8ab
Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
14f8ab
Reviewed-on: https://code.engineering.redhat.com/gerrit/175318
14f8ab
Tested-by: RHGS Build Bot <nigelb@redhat.com>
14f8ab
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
14f8ab
---
14f8ab
 libglusterfs/src/events.c | 8 +++++++-
14f8ab
 1 file changed, 7 insertions(+), 1 deletion(-)
14f8ab
14f8ab
diff --git a/libglusterfs/src/events.c b/libglusterfs/src/events.c
14f8ab
index 9b3a226..2509767 100644
14f8ab
--- a/libglusterfs/src/events.c
14f8ab
+++ b/libglusterfs/src/events.c
14f8ab
@@ -41,6 +41,7 @@ _gf_event(eventtypes_t event, const char *fmt, ...)
14f8ab
     char *host = NULL;
14f8ab
     struct addrinfo hints;
14f8ab
     struct addrinfo *result = NULL;
14f8ab
+    xlator_t *this = THIS;
14f8ab
 
14f8ab
     /* Global context */
14f8ab
     ctx = THIS->ctx;
14f8ab
@@ -82,7 +83,12 @@ _gf_event(eventtypes_t event, const char *fmt, ...)
14f8ab
     /* Socket Configurations */
14f8ab
     server.sin_family = AF_INET;
14f8ab
     server.sin_port = htons(EVENT_PORT);
14f8ab
-    server.sin_addr.s_addr = inet_addr(host);
14f8ab
+    ret = inet_pton(server.sin_family, host, &server.sin_addr);
14f8ab
+    if (ret <= 0) {
14f8ab
+        gf_msg(this->name, GF_LOG_ERROR, EINVAL, LG_MSG_INVALID_ARG,
14f8ab
+               "inet_pton failed with return code %d", ret);
14f8ab
+        goto out;
14f8ab
+    }
14f8ab
     memset(&server.sin_zero, '\0', sizeof(server.sin_zero));
14f8ab
 
14f8ab
     va_start(arguments, fmt);
14f8ab
-- 
14f8ab
1.8.3.1
14f8ab