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