bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH hurd 06/11] x86_64: use 21 bytes in libps since %z might requ


From: Samuel Thibault
Subject: Re: [PATCH hurd 06/11] x86_64: use 21 bytes in libps since %z might require more characters.
Date: Fri, 29 Dec 2023 22:41:39 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Flavio Cruz, le ven. 29 déc. 2023 16:21:00 -0500, a ecrit:
> This makes GCC happy.
> ---
>  libps/spec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libps/spec.c b/libps/spec.c
> index dec5704..9f64703 100644
> --- a/libps/spec.c
> +++ b/libps/spec.c
> @@ -492,7 +492,7 @@ error_t
>  ps_emit_nice_size_t (struct proc_stat *ps, struct ps_fmt_field *field,
>                    struct ps_stream *stream)
>  {
> -  char buf[20];
> +  char buf[21];

Mmm, the whole code seems not 64bit-clean. I'm fine with adding this
21th byte to shut the warning, although I don't think it can be useful
(the code makes sure value is < 1024, and frac_len is 3).

>    size_t value = FG_PROC_STAT (field, size_t)(ps);
>    char *sfx = " KMG";

This is lacking "TPE" to be able to support SIZE_MAX. And then we probably
want to add a compile-check that sizeof(size_t) <= 8 :)

Samuel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]