From: Dr. David Alan Gilbert Date: Mon, 6 Jan 2020 20:32:51 +0000 (+0000) Subject: passthrough_ll: pass correct errno to fuse_reply_err() X-Git-Tag: fuse-3.9.1~12 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=aa1185e153f774f1df65565f6a6fa2fb1c8cf3f3;p=qemu-gpiodev%2Flibfuse.git passthrough_ll: pass correct errno to fuse_reply_err() fuse_reply_err() expects the error code, not its negative. Upstreamed from https://www.redhat.com/archives/virtio-fs/2020-January/msg00000.html. Original commit message: lo_copy_file_range() passes -errno to fuse_reply_err() and then fuse_reply_err() changes it to errno again, so that subsequent fuse_send_reply_iov_nofree() catches the wrong errno.(i.e. reports "fuse: bad error value: ..."). Make fuse_send_reply_iov_nofree() accept the correct -errno by passing errno directly in lo_copy_file_range(). Signed-off-by: Xiao Yang Reviewed-by: Eryu Guan Co-authored-by: Xiao Yang --- diff --git a/example/passthrough_ll.c b/example/passthrough_ll.c index 5372d02..d80b493 100644 --- a/example/passthrough_ll.c +++ b/example/passthrough_ll.c @@ -1155,7 +1155,7 @@ static void lo_copy_file_range(fuse_req_t req, fuse_ino_t ino_in, off_t off_in, res = copy_file_range(fi_in->fh, &off_in, fi_out->fh, &off_out, len, flags); if (res < 0) - fuse_reply_err(req, -errno); + fuse_reply_err(req, errno); else fuse_reply_write(req, res); }