Re: [PATCH 2/8] pmqtest.c: Suppress warning

John Kacur
2025-07-25T18:07:17Z

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

> Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
> ---
> src/pmqtest/pmqtest.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
> index 04e36a1..eb20baa 100644
> --- a/src/pmqtest/pmqtest.c
> +++ b/src/pmqtest/pmqtest.c
> @@ -75,6 +75,7 @@ void *pmqthread(void *param)
> int policy = SCHED_FIFO;
> struct sched_param schedp;
> struct timespec ts;
> + int ret;
>
> memset(&schedp, 0, sizeof(schedp));
> schedp.sched_priority = par->priority;
> @@ -189,7 +190,10 @@ void *pmqthread(void *param)
> int tracing_enabled =
> open(tracing_enabled_file, O_WRONLY);
> if (tracing_enabled >= 0) {
> - write(tracing_enabled, "0", 1);
> + ret = write(tracing_enabled, "0", 1);
> + if (ret < 0)
> + fatal("Could not write to %s: %s\n",
> + tracing_enabled_file, strerror(errno));
> close(tracing_enabled);
> } else
> fatal("Could not access %s\n", tracing_enabled_file);
> --
> 2.48.1
>
>
>
Signed-off-by: John Kacur <jkacur@redhat.com>