Re: [PATCH 1/8] rt-utils.c: Suppress warning

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

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

> Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
> ---
> src/lib/rt-utils.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
> index 6bbd25a..18e515f 100644
> --- a/src/lib/rt-utils.c
> +++ b/src/lib/rt-utils.c
> @@ -465,6 +465,7 @@ void tracemark(char *fmt, ...)
> {
> va_list ap;
> int len;
> + int ret;
>
> /* bail out if we're not tracing */
> /* or if the kernel doesn't support trace_mark */
> @@ -476,10 +477,14 @@ void tracemark(char *fmt, ...)
> va_end(ap);
>
> /* write the tracemark message */
> - write(tracemark_fd, tracebuf, len);
> + ret = write(tracemark_fd, tracebuf, len);
> + if (ret != len)
> + warn("tracemark write failed");
>
> /* now stop any trace */
> - write(trace_fd, "0\n", 2);
> + ret = write(trace_fd, "0\n", 2);
> + if (ret != 2)
> + warn("trace stop write failed");
> }
>
> void enable_trace_mark(void)
> --
> 2.48.1
>
>
Signed-off-by: John Kacur <jkacur@redhat.com>