aboutsummaryrefslogtreecommitdiff
path: root/inet/inet_ntoa.c
diff options
context:
space:
mode:
Diffstat (limited to 'inet/inet_ntoa.c')
-rw-r--r--inet/inet_ntoa.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/inet/inet_ntoa.c b/inet/inet_ntoa.c
index 341d859..2efd24e 100644
--- a/inet/inet_ntoa.c
+++ b/inet/inet_ntoa.c
@@ -1,5 +1,5 @@
/* Convert Inet number to ASCII representation.
- Copyright (C) 1997-2024 Free Software Foundation, Inc.
+ Copyright (C) 1997-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -23,15 +23,12 @@
/* The interface of this function is completely stupid, it requires a
static buffer. We relax this a bit in that we allow one buffer for
each thread. */
-static __thread char buffer[18];
+static __thread char buffer[INET_ADDRSTRLEN];
char *
inet_ntoa (struct in_addr in)
{
- unsigned char *bytes = (unsigned char *) ∈
- __snprintf (buffer, sizeof (buffer), "%d.%d.%d.%d",
- bytes[0], bytes[1], bytes[2], bytes[3]);
-
+ __inet_ntop (AF_INET, &in, buffer, sizeof buffer);
return buffer;
}