2023-11-15 07:11:34

by Zhu Jun

[permalink] [raw]
Subject: [PATCH] toos:leds: Fix printf format string in uledmon.c

When the argument type is 'int',printf '%d'
in format string.Problem found during code reading.

Signed-off-by: zhujun2 <[email protected]>
---
tools/leds/uledmon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/leds/uledmon.c b/tools/leds/uledmon.c
index c15a39c1f271..62befe06eab5 100644
--- a/tools/leds/uledmon.c
+++ b/tools/leds/uledmon.c
@@ -55,7 +55,7 @@ int main(int argc, char const *argv[])
return 1;
}
clock_gettime(CLOCK_MONOTONIC, &ts);
- printf("[%ld.%09ld] %u\n", ts.tv_sec, ts.tv_nsec, brightness);
+ printf("[%ld.%09ld] %d\n", ts.tv_sec, ts.tv_nsec, brightness);
}

close(fd);
--
2.17.1




2023-11-20 22:57:57

by Ian Rogers

[permalink] [raw]
Subject: Re: [PATCH] toos:leds: Fix printf format string in uledmon.c

Nit in the subject: toos:leds: -> tools/leds:

On Tue, Nov 14, 2023 at 11:11 PM zhujun2 <[email protected]> wrote:
>
> When the argument type is 'int',printf '%d'
> in format string.Problem found during code reading.
>
> Signed-off-by: zhujun2 <[email protected]>

Reviewed-by: Ian Rogers <[email protected]>

Thanks,
Ian

> ---
> tools/leds/uledmon.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/leds/uledmon.c b/tools/leds/uledmon.c
> index c15a39c1f271..62befe06eab5 100644
> --- a/tools/leds/uledmon.c
> +++ b/tools/leds/uledmon.c
> @@ -55,7 +55,7 @@ int main(int argc, char const *argv[])
> return 1;
> }
> clock_gettime(CLOCK_MONOTONIC, &ts);
> - printf("[%ld.%09ld] %u\n", ts.tv_sec, ts.tv_nsec, brightness);
> + printf("[%ld.%09ld] %d\n", ts.tv_sec, ts.tv_nsec, brightness);
> }
>
> close(fd);
> --
> 2.17.1
>
>
>