@@ -248,12 +248,15 @@ int io_close(struct io_kiocb *req, unsigned int issue_flags)
struct io_close *close = io_kiocb_to_cmd(req);
struct fdtable *fdt;
struct file *file;
- int ret;
+ int ret, ret2;
if (close->file_slot) {
ret = io_close_fixed(req, issue_flags);
- if (ret || !(close->flags & IORING_CLOSE_FD_AND_FILE_SLOT))
+ if (!(close->flags & IORING_CLOSE_FD_AND_FILE_SLOT))
goto err;
+ else
+ ret2 = ret;
+
}
ret = -EBADF;
@@ -286,6 +289,6 @@ int io_close(struct io_kiocb *req, unsigned int issue_flags)
err:
if (ret < 0)
req_set_fail(req);
- io_req_set_res(req, ret, 0);
+ io_req_set_res(req, ret, ret2);
return IOU_OK;
}