summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@hadrons.org>2020-02-11 03:13:29 +0100
committerGuillem Jover <guillem@hadrons.org>2020-02-14 14:39:28 +0100
commit7eaeaa6947a9a1291858ed6fce5b537b6d26986f (patch)
tree4a64d53334fda081c9efb26b4265207d6d597d01
parenta72c2db426c76696cafdb59704503fa504e6a7ff (diff)
downloadliburing-7eaeaa6947a9a1291858ed6fce5b537b6d26986f.tar.gz
liburing-7eaeaa6947a9a1291858ed6fce5b537b6d26986f.tar.bz2
test: Expect fail values from io_uring calls to be -errno instead of -1
On error these functions return -errno instead of -1, otherwise we will not catch these and the tests will segfault. Signed-off-by: Guillem Jover <guillem@hadrons.org>
-rw-r--r--test/connect.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/connect.c b/test/connect.c
index 96aac97..90f53e5 100644
--- a/test/connect.c
+++ b/test/connect.c
@@ -42,7 +42,7 @@ static int submit_and_wait(struct io_uring *ring, int *res)
}
ret = io_uring_peek_cqe(ring, &cqe);
- if (ret == -1) {
+ if (ret) {
fprintf(stderr, "io_uring_peek_cqe(): no cqe returned");
return 1;
}
@@ -233,8 +233,8 @@ int main(int argc, char *argv[])
int ret;
ret = io_uring_queue_init(8, &ring, 0);
- if (ret == -1) {
- perror("io_uring_queue_setup()");
+ if (ret) {
+ fprintf(stderr, "io_uring_queue_setup() = %d\n", ret);
return 1;
}