[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [dmidecode] [PATCH] dmidecode: Fix Redfish Hostname print length
From: |
Neil Horman |
Subject: |
Re: [dmidecode] [PATCH] dmidecode: Fix Redfish Hostname print length |
Date: |
Sat, 20 Oct 2018 07:52:53 -0400 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Fri, Oct 19, 2018 at 10:51:49PM +0000, address@hidden wrote:
> From: Charles Rose <address@hidden>
>
> Redfish Hostname prints beyond hlen characters. Fix it.
>
> Signed-off-by: Charles Rose <address@hidden>
> ---
> dmidecode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/dmidecode.c b/dmidecode.c
> index a3e9d6c..7ac6438 100644
> --- a/dmidecode.c
> +++ b/dmidecode.c
> @@ -3609,7 +3609,7 @@ static void dmi_parse_protocol_record(const char
> *prefix, u8 *rec)
> hname = out_of_spec;
> hlen = strlen(out_of_spec);
> }
> - printf("%s\t\tRedfish Service Hostname: %*s\n", prefix, hlen, hname);
> + printf("%s\t\tRedfish Service Hostname: %.*s\n", prefix, hlen, hname);
> }
>
> /*
> --
> 1.8.3.1
>
Yup, last part of the Precision section from the man page specifies this:
Precision
An optional precision, in the form of a period ('.') followed by an
optional decimal digit string. Instead of a decimal digit string one may write
"*" or "*m$" (for some decimal integer m) to
specify that the precision is given in the next argument, or in the m-th
argument, respectively, which must be of type int. If the precision is given
as just '.', the precision is taken to be zero.
A negative precision is taken as if the precision were omitted. This
gives the minimum number of digits to appear for d, i, o, u, x, and X
conversions, the number of digits to appear after the
radix character for a, A, e, E, f, and F conversions, the maximum
number of significant digits for g and G conversions, or the maximum number of
characters to be printed from a string for s and S
conversions.
Acked-by: Neil Horman <address@hidden>
> _______________________________________________
> https://lists.nongnu.org/mailman/listinfo/dmidecode-devel
>