[PATCH] libga68: Fix posixstrerror by using the errnum parameter

Jose E. Marchesi jose.marchesi@oracle.com
Sun Oct 19 09:22:08 GMT 2025


Hello Pietro.

I applied the patch in a68 and is also part of the a68-v4 sent for
upstream review.

Thanks!

> Sent to the forge too: https://forge.sourceware.org/gcc/gcc-a68/pulls/7
>
> pietro
> ---8<---
> From: Pietro Monteiro <pietro@sociotechnical.xyz>
> Date: Sat, 11 Oct 2025 19:34:32 -0400
> Subject: [PATCH] libga68: Fix posixstrerror by using the errnum parameter
>
> Instead of using the `errnum' parameter as described in the documentation
> `_libga68_posixstrerror' used `_libga68_errno' to get the error
> message.  Fix this by passing `errnum' to `strerror'.
>
> ChangeLog:
>         * libga68/ga68-posix.c (_libga68_posixstrerror): Use `errnum'
>         to get the error string.
>
> Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
> ---
>  libga68/ga68-posix.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libga68/ga68-posix.c b/libga68/ga68-posix.c
> index 653807df612..cd8104cdc51 100644
> --- a/libga68/ga68-posix.c
> +++ b/libga68/ga68-posix.c
> @@ -67,8 +67,8 @@ _libga68_posixperror (uint32_t *s, size_t len, size_t stride)
>  uint32_t *
>  _libga68_posixstrerror (int errnum, size_t *len)
>  {
> -  char *str = strerror (_libga68_errno);
> -  return _libga68_u8_to_u32 (str, strlen (str), NULL, len);
> +  const char *str = strerror (errnum);
> +  return _libga68_u8_to_u32 ((const uint8_t *)str, strlen (str), NULL, len);
>  }
>
>  #define FILE_O_DEFAULT 0x0


More information about the Algol68 mailing list