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