diff options
author | Rinku Kothiya <rkothiya@redhat.com> | 2019-06-14 07:53:06 +0000 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2019-06-24 08:25:39 +0000 |
commit | aeb4545f35ef2740db36387cb855dcaa6bafb03d (patch) | |
tree | 1044e4593e49ed62ca920bc3fa3ca745811c85d5 /libglusterfs | |
parent | 665d627e865d8cfa6a454c2c79eed9e9a1276865 (diff) |
core: replace inet_addr with inet_pton
Fixes warning raised by RPMDiff on the use of inet_addr, which may
impact Ipv6 support
fixes: bz#1721385
Change-Id: Id2d9afa1747efa64bc79d90dd2566bff54deedeb
Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/events.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libglusterfs/src/events.c b/libglusterfs/src/events.c index 9b3a2268b69..25097675a9e 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); |