From 6e8946b2137918fbd957ed2e574fa5c597cb1de1 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Sat, 2 Nov 2024 16:20:09 -0600 Subject: [PATCH] examples/reg-wait: appease source checker Check the output value of write... Signed-off-by: Jens Axboe --- examples/reg-wait.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/reg-wait.c b/examples/reg-wait.c index ce0216b15..d86282d1f 100644 --- a/examples/reg-wait.c +++ b/examples/reg-wait.c @@ -48,6 +48,11 @@ int main(int argc, char *argv[]) struct timeval tv; int ret, fds[2]; + if (argc > 1) { + fprintf(stdout, "%s: takes no arguments\n", argv[0]); + return 0; + } + if (pipe(fds) < 0) { perror("pipe"); return 1; @@ -122,7 +127,11 @@ int main(int argc, char *argv[]) io_uring_prep_read(sqe, fds[0], b2, sizeof(b2), 0); /* trigger one read */ - write(fds[1], "Hello", 5); + ret = write(fds[1], "Hello", 5); + if (ret < 0) { + perror("write"); + return 1; + } /* * This should will wait for 2 entries, where 1 is already available.