From 9d7d6480880064cb5219aa267894ffabd0c2b20c Mon Sep 17 00:00:00 2001 From: Magnus Lindholm Date: Mon, 10 Aug 2026 00:08:02 +0200 Subject: [PATCH] alpha: Use the generic gethostname alpha was the only target implementing gethostname with the syscall rather than through uname. Its only behavioural difference was the errno for a too-small buffer: it reported EOVERFLOW where the generic implementation, gethostname(2) and misc/tst-gethostname expect ENAMETOOLONG, so alpha failed that test: tst-gethostname.c:96: numeric comparison failure left: 112 (0x70, EOVERFLOW); from: errno right: 63 (0x3f); from: ENAMETOOLONG The file contains nothing but that function, so removing it lets the sysdeps search fall through to sysdeps/posix/gethostname.c, which produces the same buffer contents and the expected errno. misc/tst-gethostname passes on alpha with it. Suggested-by: Florian Weimer Signed-off-by: Magnus Lindholm Reviewed-by: Florian Weimer --- sysdeps/unix/sysv/linux/alpha/gethostname.c | 44 --------------------- 1 file changed, 44 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/alpha/gethostname.c diff --git a/sysdeps/unix/sysv/linux/alpha/gethostname.c b/sysdeps/unix/sysv/linux/alpha/gethostname.c deleted file mode 100644 index d2bd213c24..0000000000 --- a/sysdeps/unix/sysv/linux/alpha/gethostname.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 2001-2026 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 - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#include -#include -#include - -#include -#include - -int -__gethostname (char *name, size_t len) -{ - int result; - - result = INLINE_SYSCALL (gethostname, 2, name, len); - - if (result == 0 - /* See whether the string is terminated. If not we will return - an error. */ - && memchr (name, '\0', len) == NULL) - { - __set_errno (EOVERFLOW); - result = -1; - } - - return result; -} - -weak_alias (__gethostname, gethostname) -- 2.47.3