[PATCH] alpha: Fix gethostname errno for a too-small buffer
Magnus Lindholm
linmag7@gmail.com
Sun Aug 9 20:51:10 GMT 2026
alpha is the only target that implements gethostname with the syscall
rather than through uname, and it reports EOVERFLOW when the name does
not fit. Every other target, gethostname(2) and misc/tst-gethostname
expect ENAMETOOLONG:
tst-gethostname.c:96: numeric comparison failure
left: 112 (0x70, EOVERFLOW); from: errno
right: 63 (0x3f); from: ENAMETOOLONG
The kernel already truncates the name and fills the buffer, so only the
errno value changes. misc/tst-gethostname passes on alpha with this.
Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
---
sysdeps/unix/sysv/linux/alpha/gethostname.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysdeps/unix/sysv/linux/alpha/gethostname.c b/sysdeps/unix/sysv/linux/alpha/gethostname.c
index d2bd213c24..b7ac91bb30 100644
--- a/sysdeps/unix/sysv/linux/alpha/gethostname.c
+++ b/sysdeps/unix/sysv/linux/alpha/gethostname.c
@@ -34,7 +34,7 @@ __gethostname (char *name, size_t len)
an error. */
&& memchr (name, '\0', len) == NULL)
{
- __set_errno (EOVERFLOW);
+ __set_errno (ENAMETOOLONG);
result = -1;
}
--
2.55.0
More information about the Libc-alpha
mailing list