aboutsummaryrefslogtreecommitdiff
path: root/ares/inet_ntop.c
diff options
context:
space:
mode:
Diffstat (limited to 'ares/inet_ntop.c')
-rw-r--r--ares/inet_ntop.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/ares/inet_ntop.c b/ares/inet_ntop.c
index 097e7764e..f076e0665 100644
--- a/ares/inet_ntop.c
+++ b/ares/inet_ntop.c
@@ -68,6 +68,11 @@ static const char *inet_ntop6(const unsigned char *src, char *dst, size_t size);
* convert a network format address to presentation format.
* return:
* pointer to presentation format address (`dst'), or NULL (see errno).
+ * note:
+ * On Windows we store the error in the thread errno, not
+ * in the winsock error code. This is to avoid loosing the
+ * actual last winsock error. So use macro ERRNO to fetch the
+ * errno this funtion sets when returning NULL, not SOCKERRNO.
* author:
* Paul Vixie, 1996.
*/
@@ -81,7 +86,7 @@ ares_inet_ntop(int af, const void *src, char *dst, size_t size)
case AF_INET6:
return (inet_ntop6(src, dst, size));
default:
- errno = EAFNOSUPPORT;
+ SET_ERRNO(EAFNOSUPPORT);
return (NULL);
}
/* NOTREACHED */
@@ -106,7 +111,7 @@ inet_ntop4(const unsigned char *src, char *dst, size_t size)
if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size)
{
- errno = ENOSPC;
+ SET_ERRNO(ENOSPC);
return (NULL);
}
strcpy(dst, tmp);
@@ -218,7 +223,7 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size)
*/
if ((size_t)(tp - tmp) > size)
{
- errno = ENOSPC;
+ SET_ERRNO(ENOSPC);
return (NULL);
}
strcpy(dst, tmp);