From 225450d043bfa5a9814c6ec7fa18d16ce28c6fa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 29 Jul 2025 15:14:27 +0200 Subject: [PATCH] Revert "errno-list: fallback to use our errno name table" This reverts commit c4ffd0a02075f14c6124b1da2219e15f7e4fd64b. With this change we fully duplicate the functionality in glibc. This patch was motivated by glibc missing some names, but those are in the process of being added: https://sourceware.org/pipermail/libc-alpha/2025-July/169007.html --- src/basic/errno-list.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/basic/errno-list.c b/src/basic/errno-list.c index 1cad1f6a5d..8de9888083 100644 --- a/src/basic/errno-list.c +++ b/src/basic/errno-list.c @@ -10,7 +10,6 @@ static const struct errno_name* lookup_errno(register const char *str, register GPERF_LEN_TYPE len); #include "errno-from-name.inc" -#include "errno-to-name.inc" int errno_from_name(const char *name) { const struct errno_name *sc; @@ -25,24 +24,26 @@ int errno_from_name(const char *name) { return sc->id; } +#if HAVE_STRERRORNAME_NP const char* errno_to_name(int id) { if (id == 0) /* To stay in line with our own impl */ return NULL; + return strerrorname_np(ABS(id)); +} +#else +# include "errno-to-name.inc" + +const char* errno_to_name(int id) { if (id < 0) id = -id; -#if HAVE_STRERRORNAME_NP - const char *n = strerrorname_np(id); - if (n) - return n; -#endif - if ((size_t) id >= ELEMENTSOF(errno_names)) return NULL; return errno_names[id]; } +#endif const char* errno_name_full(int id, char buf[static ERRNO_NAME_BUF_LEN]) { const char *a = errno_to_name(id);