From: Collin Funk Date: Thu, 27 Jun 2024 07:50:16 +0000 (-0700) Subject: netdb: Define NI_MAXHOST and NI_MAXSERV. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=a6dfa6add8326e7e946c5eb69e8c0b2d41f9331e;p=gnulib.git netdb: Define NI_MAXHOST and NI_MAXSERV. * doc/posix-headers/netdb.texi (netdb.h): Document definitions that differ from RFC 2553. * lib/netdb.in.h (NI_MAXHOST, NI_MAXSERV): Define NI_MAXHOST and NI_MAXSERV. --- diff --git a/ChangeLog b/ChangeLog index c0526832f6..61a4bc1236 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2024-06-27 Collin Funk + + netdb: Define NI_MAXHOST and NI_MAXSERV. + * doc/posix-headers/netdb.texi (netdb.h): Document definitions that + differ from RFC 2553. + * lib/netdb.in.h (NI_MAXHOST, NI_MAXSERV): Define NI_MAXHOST and + NI_MAXSERV. + 2024-06-26 Paul Eggert strnlen: document Android bug diff --git a/doc/posix-headers/netdb.texi b/doc/posix-headers/netdb.texi index 33631378a0..47caaf8c31 100644 --- a/doc/posix-headers/netdb.texi +++ b/doc/posix-headers/netdb.texi @@ -25,6 +25,12 @@ This header file does not define @code{AI_ADDRCONFIG} on some platforms: NetBSD 5.0. @end itemize +@item +@c Defined in RFC 2553. +This header file incorrectly defines @code{NI_MAXHOST} on some platforms: +musl libc 1.2.4, OpenBSD 7.5. +@end + Portability problems not fixed by Gnulib: @itemize @end itemize diff --git a/lib/netdb.in.h b/lib/netdb.in.h index 43409b2f03..6267b544b0 100644 --- a/lib/netdb.in.h +++ b/lib/netdb.in.h @@ -54,6 +54,22 @@ /* Declarations for a platform that lacks , or where it is incomplete. */ +/* Maximumn length of a fully-qualified domain name. */ +#ifndef NI_MAXHOST +# define NI_MAXHOST 1025 +#elif NI_MAXHOST != 1025 +# undef NI_MAXHOST +# define NI_MAXHOST 1025 +#endif + +/* Maximumn length of a service. */ +#ifndef NI_MAXSERV +# define NI_MAXSERV 32 +#elif NI_MAXSERV != 32 +# undef NI_MAXSERV 32 +# define NI_MAXSERV 32 +#endif + #if @GNULIB_GETADDRINFO@ # if !@HAVE_STRUCT_ADDRINFO@