mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [PATCH] getservbyport_r: fix wrong result if getnameinfo fails with EAI_OVERFLOW
@ 2023-02-27 20:33 Alexey Izbyshev
  0 siblings, 0 replies; only message in thread
From: Alexey Izbyshev @ 2023-02-27 20:33 UTC (permalink / raw)
  To: musl

EAI_OVERFLOW should be propagated as ERANGE to inform the caller about
the need to expand the buffer.
---
 src/network/getservbyport_r.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/network/getservbyport_r.c b/src/network/getservbyport_r.c
index b7f21c6b..f8d1e854 100644
--- a/src/network/getservbyport_r.c
+++ b/src/network/getservbyport_r.c
@@ -46,6 +46,8 @@ int getservbyport_r(int port, const char *prots,
 	case EAI_MEMORY:
 	case EAI_SYSTEM:
 		return ENOMEM;
+	case EAI_OVERFLOW:
+		return ERANGE;
 	default:
 		return ENOENT;
 	case 0:
-- 
2.39.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-27 20:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-27 20:33 [musl] [PATCH] getservbyport_r: fix wrong result if getnameinfo fails with EAI_OVERFLOW Alexey Izbyshev

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).