alpha: Change gethostname overflow errno from EOVERFLOW to ENAMETOOLONG

Message ID 20260604092410.185621-1-panzhe@kylinos.cn (mailing list archive)
State Changes Requested
Headers
Series alpha: Change gethostname overflow errno from EOVERFLOW to ENAMETOOLONG |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Test passed

Commit Message

panzhe June 4, 2026, 9:24 a.m. UTC
  Align alpha gethostname implementation with man-pages
spec, return ENAMETOOLONG instead of EOVERFLOW when
buffer is too small.

References:
https://man7.org/linux/man-pages/man2/gethostname.2.html

Signed-off-by: panzhe <panzhe@kylinos.cn>
---
 sysdeps/unix/sysv/linux/alpha/gethostname.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Adhemerval Zanella Netto June 4, 2026, 12:14 p.m. UTC | #1
On 04/06/26 06:24, panzhe wrote:
> Align alpha gethostname implementation with man-pages
> spec, return ENAMETOOLONG instead of EOVERFLOW when
> buffer is too small.
> 
> References:
> https://man7.org/linux/man-pages/man2/gethostname.2.html
> 
> Signed-off-by: panzhe <panzhe@kylinos.cn>

I would just remove the alpha implementation and the generic posix one
that issues uname.

> ---
>  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;
>      }
>
  

Patch

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;
     }