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