liburing/handle-eintr.patch

53 lines
1.2 KiB
Diff

--- liburing-2.2/test/ce593a6c480a.c
+++ liburing-2.2/test/ce593a6c480a.c
@@ -111,15 +111,16 @@
(void*) (intptr_t) other_fd);
/* Wait on the event fd for an event to be ready */
- ret = read(loop_fd, buf, 8);
- if (ret < 0) {
- perror("read");
- return 1;
- } else if (ret != 8) {
- fprintf(stderr, "Odd-sized eventfd read: %d\n", ret);
- return 1;
- }
-
+ do {
+ ret = read(loop_fd, buf, 8);
+ if (ret < 0 && errno != EINTR) {
+ perror("read");
+ return 1;
+ } else if (ret > 0 && ret != 8) {
+ fprintf(stderr, "Odd-sized eventfd read: %d\n", ret);
+ return 1;
+ }
+ } while (ret < 0);
ret = io_uring_wait_cqe(&ring, &cqe);
if (ret) {
--- liburing-2.2/test/io-cancel.c
+++ liburing-2.2/test/io-cancel.c
@@ -366,10 +366,17 @@
} else {
int wstatus;
- if (waitpid(p, &wstatus, 0) == (pid_t)-1) {
- perror("waitpid()");
- return 1;
- }
+ do {
+ if (waitpid(p, &wstatus, 0) == (pid_t)-1) {
+ if (errno == EINTR) {
+ continue;
+ }
+ perror("waitpid()");
+ return 1;
+ }
+ break;
+ } while (1);
+
if (!WIFEXITED(wstatus) || WEXITSTATUS(wstatus)) {
fprintf(stderr, "child failed %i\n", WEXITSTATUS(wstatus));
return 1;