erofs-utils: fix 'warn_unused_result'
PATCH 1/1 erofs-utils: fix 'warn_unused_result'
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(-)
lib/backends/ublk.c +4 -1
@@ -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 ; }
mount/main.c +4 -2
@@ -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)
Signature · 1 line
2.43.5