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 <[email protected]>
---
 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 via email to