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