Skip to content

Commit

Permalink
src: fix crash after when system sleep
Browse files Browse the repository at this point in the history
After Suspend-to-RAM, io_uring wait returns error EINTR.

Test with below command
$ echo mem > /sys/power/state

see: https://www.kernel.org/doc/html/v4.18/admin-guide/pm/sleep-states.html
  • Loading branch information
e2dk4r committed Oct 19, 2024
1 parent 90e239a commit 09f6a74
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,13 @@ main(void)
wait:
error = io_uring_wait_cqe(&ring, &cqe);
if (error) {
if (errno == EAGAIN)
error *= -1;
if (error == EAGAIN || error == EINTR)
goto wait;
fatal("io_uring\n");
#if GAMEPAD_IDLE_INHIBIT_DEBUG
printf("errno: %d %s\n", -error, strerror(-error));
#endif
error_code = GAMEPAD_ERROR_IO_URING_WAIT;
break;
}
Expand Down

0 comments on commit 09f6a74

Please sign in to comment.