From: Romain Vimont Date: Tue, 11 Oct 2016 19:51:31 +0000 (+0200) Subject: linux_udev: Retry poll() on EINTR X-Git-Tag: upstream/1.0.22~155 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0a02d1212bfb7ff2e9f3fc603655b0220b7d6889;hp=09e75e98b4d9ea7909e8837b7a3f00dda4589dc3;p=platform%2Fupstream%2Flibusb.git linux_udev: Retry poll() on EINTR The poll() syscall may temporarily fail when it is interrupted by a signal; -1 is returned and errno is set to EINTR. When this occurred, the udev event thread exited. Instead, since this is a temporary failure, just try the call again. Signed-off-by: Romain Vimont Signed-off-by: Hans de Goede --- diff --git a/libusb/os/linux_udev.c b/libusb/os/linux_udev.c index ea27142..61d953d 100644 --- a/libusb/os/linux_udev.c +++ b/libusb/os/linux_udev.c @@ -172,7 +172,11 @@ static void *linux_udev_event_thread_main(void *arg) usbi_dbg("udev event thread entering."); - while (poll(fds, 2, -1) >= 0) { + while ((r = poll(fds, 2, -1)) >= 0 || errno == EINTR) { + if (r < 0) { + /* temporary failure */ + continue; + } if (fds[0].revents & POLLIN) { /* activity on control pipe, read the byte and exit */ r = usbi_read(udev_control_pipe[0], &dummy, sizeof(dummy)); diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 58cb0fb..10b89fc 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11156 +#define LIBUSB_NANO 11157