aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2024-04-19 17:31:15 -0600
committerJens Axboe <axboe@kernel.dk>2024-04-19 17:31:15 -0600
commitf4281698fd966e6de665c1fb144594c1420f9e73 (patch)
tree78c8c1d39510c70a25cd09072ec30a7b9d69c913
parent1cbd4cffa881772d54d7d1a98755101253a66d0a (diff)
downloadliburing-f4281698fd966e6de665c1fb144594c1420f9e73.tar.gz
test/socket-io-cmd: don't use CQE after io_uring_cqe_seen()
Doesn't matter here as there's only one SQE inflight and no more CQEs will get generated before this one is done, but it's bad practice. CQEs should always be fully read before they are marked as seen. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--test/socket-io-cmd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/socket-io-cmd.c b/test/socket-io-cmd.c
index f1f1465..ba1f104 100644
--- a/test/socket-io-cmd.c
+++ b/test/socket-io-cmd.c
@@ -66,10 +66,11 @@ static int receive_cqe(struct io_uring *ring)
err = io_uring_wait_cqe(ring, &cqe);
assert(err == 0);
assert(cqe->user_data == USERDATA);
+ err = cqe->res;
io_uring_cqe_seen(ring, cqe);
/* Return the result of the operation */
- return cqe->res;
+ return err;
}
static ssize_t send_data(struct fds *s, char *str)