From: John Kacur <jkacur@gmail.com>
To: Gabriele Monaco <gmonaco@redhat.com>
Cc: linux-rt-users@vger.kernel.org, John Kacur <jkacur@redhat.com>,
Clark Williams <williams@redhat.com>
Subject: Re: [PATCH] rt-utils.c: Fix write() return value check
Date: Thu, 19 Feb 2026 13:18:17 -0500 (EST) [thread overview]
Message-ID: <7d50c77e-de2d-1b35-c896-62fc70453a4e@gmail.com> (raw)
In-Reply-To: <20260212111342.71398-1-gmonaco@redhat.com>
On Thu, 12 Feb 2026, Gabriele Monaco wrote:
> The write() return value check in tracemark() is a copy-paste from the
> one in tracing_stop() which checks for 2 bytes to be written. As a
> result, tracemark() is almost always warning.
>
> Check for the write() return value to be equal to the written length,
> which is the value returned if no error occurred.
> While at it, add "\n" to the warn messages.
>
> Fixes: 60d60540c009 ("rt-utils.c: Check return values of write()")
> Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
> ---
> src/lib/rt-utils.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
> index d800b5f..aa70c78 100644
> --- a/src/lib/rt-utils.c
> +++ b/src/lib/rt-utils.c
> @@ -437,8 +437,8 @@ void tracemark(char *fmt, ...)
>
> /* write the tracemark message */
> ret = write(tracemark_fd, tracebuf, len);
> - if (ret != 2)
> - warn("trace stop write failed");
> + if (ret != len)
> + warn("trace mark write failed\n");
> }
>
> void tracing_stop(void)
> @@ -449,7 +449,7 @@ void tracing_stop(void)
> return;
> ret = write(trace_fd, "0\n", 2);
> if (ret != 2)
> - warn("trace stop write failed");
> + warn("trace stop write failed\n");
> }
>
> void enable_trace_mark(void)
>
> base-commit: 4e68b52f0e0c9777c91088948374c6ee3d4a1f6b
> --
Signed-off-by: John Kacur <jkacur@redhat.com>
prev parent reply other threads:[~2026-02-19 18:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-12 11:13 [PATCH] rt-utils.c: Fix write() return value check Gabriele Monaco
2026-02-19 18:18 ` John Kacur [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7d50c77e-de2d-1b35-c896-62fc70453a4e@gmail.com \
--to=jkacur@gmail.com \
--cc=gmonaco@redhat.com \
--cc=jkacur@redhat.com \
--cc=linux-rt-users@vger.kernel.org \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox