Commit b10a1c0f authored by Mike Frysinger's avatar Mike Frysinger

lib: inet: switch to inet_ntop

This avoids casting from a char* pointer to a struct in_addr* pointer
which have different alignment requirements, and moves away from the
deprecated inet_ntoa function.

URL: https://bugs.gentoo.org/558436
parent 16a83b4f
...@@ -240,7 +240,11 @@ static void INET_reserror(const char *text) ...@@ -240,7 +240,11 @@ static void INET_reserror(const char *text)
/* Display an Internet socket address. */ /* Display an Internet socket address. */
static const char *INET_print(const char *ptr) static const char *INET_print(const char *ptr)
{ {
return (inet_ntoa((*(struct in_addr *) ptr))); static char name[INET_ADDRSTRLEN + 1];
socklen_t len = sizeof(name) - 1;
name[len] = '\0';
inet_ntop(AF_INET, ptr, name, len);
return name;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment