summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libglusterfs/src/events.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libglusterfs/src/events.c b/libglusterfs/src/events.c
index 5c39a1a..11b4c54 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;
char *volfile_server_transport = NULL;
/* Global context */
@@ -91,7 +92,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);