From: Gabriele Monaco <gmonaco@redhat.com>
To: linux-rt-users@vger.kernel.org, John Kacur <jkacur@redhat.com>,
Clark Williams <williams@redhat.com>
Cc: Gabriele Monaco <gmonaco@redhat.com>
Subject: [PATCH] rt-utils.c: Fix write() return value check
Date: Thu, 12 Feb 2026 12:13:42 +0100 [thread overview]
Message-ID: <20260212111342.71398-1-gmonaco@redhat.com> (raw)
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
--
2.53.0
next reply other threads:[~2026-02-12 11:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-12 11:13 Gabriele Monaco [this message]
2026-02-19 18:18 ` [PATCH] rt-utils.c: Fix write() return value check John Kacur
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=20260212111342.71398-1-gmonaco@redhat.com \
--to=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