Re: [PATCH 4/8] rt-migrate-test.c: Suppress warning

John Kacur
2025-07-25T18:10:46Z

On Sat, 12 Jul 2025, Cheng-Yang Chou wrote:

> Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
> ---
> src/rt-migrate-test/rt-migrate-test.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
> index 8afe083..d7c0bf3 100644
> --- a/src/rt-migrate-test/rt-migrate-test.c
> +++ b/src/rt-migrate-test/rt-migrate-test.c
> @@ -61,6 +61,7 @@ static void ftrace_write(const char *fmt, ...)
> {
> va_list ap;
> int n;
> + int ret;
>
> if (mark_fd < 0)
> return;
> @@ -69,7 +70,9 @@ static void ftrace_write(const char *fmt, ...)
> n = vsnprintf(buff, BUFSIZ, fmt, ap);
> va_end(ap);
>
> - write(mark_fd, buff, n);
> + ret = write(mark_fd, buff, n);
> + if (ret < 0)
> + perror("ftrace_write failed");
> }
>
> #define nano2sec(nan) (nan / 1000000000ULL)
> --
> 2.48.1
>
>
>
Signed-off-by: John Kacur <jkacur@redhat.com>