Linux-EROFS Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: linux-erofs@lists.ozlabs.org
Cc: oliver.yang@linux.alibaba.com, Gao Xiang <hsiangkao@linux.alibaba.com>
Subject: [PATCH] erofs-utils: fix 'warn_unused_result'
Date: Sat,  4 Jul 2026 10:03:47 +0800	[thread overview]
Message-ID: <20260704020347.3119610-1-hsiangkao@linux.alibaba.com> (raw)

backends/ublk.c: In function 'ublk_queue_thread':
backends/ublk.c:758:23: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  758 |                 (void)write(q->dev->stop_efd, &val, sizeof(val));
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

main.c: In function 'erofsmount_fanotify_child':
main.c:2043:9: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
 2043 |         write(pipefd, &err, sizeof(err));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 lib/backends/ublk.c | 5 ++++-
 mount/main.c        | 6 ++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/backends/ublk.c b/lib/backends/ublk.c
index 090c6d5bd1e8..b63d121e54ac 100644
--- a/lib/backends/ublk.c
+++ b/lib/backends/ublk.c
@@ -755,7 +755,10 @@ static void *ublk_queue_thread(void *arg)
 	if (q->dev->stop_efd >= 0) {
 		uint64_t val = 1;
 
-		(void)write(q->dev->stop_efd, &val, sizeof(val));
+		ret = write(q->dev->stop_efd, &val, sizeof(val));
+		if (ret < 0)
+			erofs_err("failed to write stop event for queue %d: %s",
+				  q->q_id, strerror(errno));
 	}
 	return NULL;
 }
diff --git a/mount/main.c b/mount/main.c
index ec27dcb53eb3..347a71b8a41c 100644
--- a/mount/main.c
+++ b/mount/main.c
@@ -2026,7 +2026,7 @@ static void erofsmount_fanotify_ctx_cleanup(struct erofs_fanotify_ctx *ctx)
 static int erofsmount_fanotify_child(struct erofs_fanotify_ctx *ctx,
 				     int pipefd)
 {
-	int err;
+	int err, err2;
 
 	ctx->fan_fd = erofs_fanotify_init_precontent();
 	if (ctx->fan_fd < 0) {
@@ -2040,7 +2040,9 @@ static int erofsmount_fanotify_child(struct erofs_fanotify_ctx *ctx,
 
 	err = 0;
 notify:
-	write(pipefd, &err, sizeof(err));
+	err2 = write(pipefd, &err, sizeof(err));
+	if (err2 < 0)
+		erofs_err("failed to notify parent: %s", strerror(errno));
 	close(pipefd);
 
 	if (err)
-- 
2.43.5



                 reply	other threads:[~2026-07-04  2:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260704020347.3119610-1-hsiangkao@linux.alibaba.com \
    --to=hsiangkao@linux.alibaba.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=oliver.yang@linux.alibaba.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