[PATCH 2/3] sunrpc: Fix netname build with older gcc

Carlos O'Donell carlos@redhat.com
Wed Jul 26 02:27:39 GMT 2023


On 7/24/23 13:15, Adhemerval Zanella via Libc-alpha wrote:
> The -Wformat-overflow was added by gcc 8.

LGTM.

These are already approved by the RM to clean these up.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  sunrpc/netname.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/sunrpc/netname.c b/sunrpc/netname.c
> index d9d82501b0..9e2f78329e 100644
> --- a/sunrpc/netname.c
> +++ b/sunrpc/netname.c
> @@ -52,10 +52,14 @@ user2netname (char netname[MAXNETNAMELEN + 1], const uid_t uid,
>    /* GCC with -Os or -O1 warns that sprint might overflow while handling
>       dfltdom, however the above test does check if an overflow would
>       happen.  */
> +#if __GNUC_PREREQ (8, 0)
>    DIAG_PUSH_NEEDS_COMMENT;
>    DIAG_IGNORE_NEEDS_COMMENT (8, "-Wformat-overflow");
> +#endif
>    sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
> +#if __GNUC_PREREQ (8, 0)
>    DIAG_POP_NEEDS_COMMENT;
> +#endif
>    i = strlen (netname);
>    if (netname[i - 1] == '.')
>      netname[i - 1] = '\0';

-- 
Cheers,
Carlos.



More information about the Libc-alpha mailing list