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