mirror of
https://github.com/Lekensteyn/ltunify.git
synced 2025-12-09 10:03:23 +00:00
read-dev-usbmon: retry ioctl when interrupted
Allows read-dev-usbmon to function after suspend/resume.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h> /* getenv */
|
||||
#include <errno.h>
|
||||
|
||||
typedef uint16_t u16;
|
||||
typedef int32_t s32;
|
||||
@@ -104,6 +105,9 @@ int main(int argc, char ** argv) {
|
||||
for (;;) {
|
||||
memset(&data, 0xCC, sizeof data); // for debugging purposes
|
||||
r = ioctl(fd, MON_IOCX_GET, &event);
|
||||
if (r == -1 && errno == EINTR) {
|
||||
continue;
|
||||
}
|
||||
if (r < 0) {
|
||||
perror("ioctl");
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user