linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: Cheng-Yang Chou <yphbchou0911@gmail.com>
Cc: williams@redhat.com, linux-rt-users@vger.kernel.org,
	 jserv@ccns.ncku.edu.tw
Subject: Re: [PATCH v2 4/8] rt-migrate-test.c: Check return values of write() and ftruncate()
Date: Fri, 26 Sep 2025 15:49:21 -0400 (EDT)	[thread overview]
Message-ID: <840ece3a-1144-a317-8929-b200b6ceab6b@redhat.com> (raw)
In-Reply-To: <20250726091837.493915-5-yphbchou0911@gmail.com>



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

> Add error handling for write() to tracefs and ftruncate() on shared memory
> to avoid ignoring errors.
> 
> Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
> ---
>  src/rt-migrate-test/rt-migrate-test.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
> index 8afe083..e007ed7 100644
> --- a/src/rt-migrate-test/rt-migrate-test.c
> +++ b/src/rt-migrate-test/rt-migrate-test.c
> @@ -61,6 +61,7 @@ static void ftrace_write(const char *fmt, ...)
>  {
>  	va_list ap;
>  	int n;
> +	int ret;
>  
>  	if (mark_fd < 0)
>  		return;
> @@ -69,7 +70,9 @@ static void ftrace_write(const char *fmt, ...)
>  	n = vsnprintf(buff, BUFSIZ, fmt, ap);
>  	va_end(ap);
>  
> -	write(mark_fd, buff, n);
> +	ret = write(mark_fd, buff, n);
> +	if (ret < 0)
> +		fprintf(stderr, "%s: write failed\n", __func__);
>  }
>  
>  #define nano2sec(nan) (nan / 1000000000ULL)
> -- 

Signed-off-by: John Kacur <jkacur@redhat.com>


  reply	other threads:[~2025-09-26 19:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-26  9:18 [PATCH v2 0/8] Fix -Wunused-result warnings by checking return values Cheng-Yang Chou
2025-07-26  9:18 ` [PATCH v2 1/8] rt-utils.c: Check return values of write() Cheng-Yang Chou
2025-09-26 17:38   ` John Kacur
2025-07-26  9:18 ` [PATCH v2 2/8] pmqtest.c: Check return values of write() and ftruncate() Cheng-Yang Chou
2025-09-26 17:40   ` John Kacur
2025-07-26  9:18 ` [PATCH v2 3/8] ptsematest.c: " Cheng-Yang Chou
2025-09-26 17:57   ` John Kacur
2025-07-26  9:18 ` [PATCH v2 4/8] rt-migrate-test.c: " Cheng-Yang Chou
2025-09-26 19:49   ` John Kacur [this message]
2025-07-26  9:18 ` [PATCH v2 5/8] cyclicdeadline.c: " Cheng-Yang Chou
2025-09-26 19:58   ` John Kacur
2025-07-26  9:18 ` [PATCH v2 6/8] deadline_test.c: " Cheng-Yang Chou
2025-09-26 20:00   ` John Kacur
2025-07-26  9:18 ` [PATCH v2 7/8] sigwaittest.c: " Cheng-Yang Chou
2025-09-26 20:01   ` John Kacur
2025-07-26  9:18 ` [PATCH v2 8/8] svsematest.c: " Cheng-Yang Chou
2025-09-26 20:03   ` John Kacur
2025-08-07 16:26 ` [PATCH v2 0/8] Fix -Wunused-result warnings by checking return values Cheng-Yang Chou
2025-08-23 12:40   ` Cheng-Yang Chou
2025-09-05 18:27     ` Cheng-Yang Chou

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=840ece3a-1144-a317-8929-b200b6ceab6b@redhat.com \
    --to=jkacur@redhat.com \
    --cc=jserv@ccns.ncku.edu.tw \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=williams@redhat.com \
    --cc=yphbchou0911@gmail.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;
as well as URLs for NNTP newsgroup(s).