Re: [PATCH 3/8] ptsematest.c: Suppress warning

John Kacur
2025-07-25T18:09:22Z

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

> Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
> ---
> src/ptsematest/ptsematest.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
> index d211669..787909c 100644
> --- a/src/ptsematest/ptsematest.c
> +++ b/src/ptsematest/ptsematest.c
> @@ -62,6 +62,7 @@ void *semathread(void *param)
> cpu_set_t mask;
> int policy = SCHED_FIFO;
> struct sched_param schedp;
> + int ret;
>
> memset(&schedp, 0, sizeof(schedp));
> schedp.sched_priority = par->priority;
> @@ -112,7 +113,10 @@ void *semathread(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",
> --
> 2.48.1
>
>
>
Signed-off-by: John Kacur <jkacur@redhat.com>