Blame SOURCES/0229-RHBZ-1467987-poll-on-udev-monitor.patch

4ae388
---
4ae388
 libmultipath/uevent.c |   16 ++++++++++++++++
4ae388
 1 file changed, 16 insertions(+)
4ae388
4ae388
Index: multipath-tools-130222/libmultipath/uevent.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/uevent.c
4ae388
+++ multipath-tools-130222/libmultipath/uevent.c
4ae388
@@ -41,6 +41,7 @@
4ae388
 #include <sys/mman.h>
4ae388
 #include <libudev.h>
4ae388
 #include <errno.h>
4ae388
+#include <poll.h>
4ae388
 
4ae388
 #include "memory.h"
4ae388
 #include "debug.h"
4ae388
@@ -460,6 +461,21 @@ int uevent_listen(struct udev *udev)
4ae388
 		struct uevent *uev;
4ae388
 		struct udev_device *dev;
4ae388
                 struct udev_list_entry *list_entry;
4ae388
+		struct pollfd ev_poll;
4ae388
+		int fdcount;
4ae388
+
4ae388
+		memset(&ev_poll, 0, sizeof(struct pollfd));
4ae388
+		ev_poll.fd = fd;
4ae388
+		ev_poll.events = POLLIN;
4ae388
+		errno = 0;
4ae388
+		fdcount = poll(&ev_poll, 1, -1);
4ae388
+		if (fdcount <= 0 || !(ev_poll.revents & POLLIN)) {
4ae388
+			if (!errno || errno == EINTR)
4ae388
+				continue;
4ae388
+			condlog(0, "error receiving uevent message");
4ae388
+			err = -errno;
4ae388
+			break;
4ae388
+		}
4ae388
 
4ae388
 		dev = udev_monitor_receive_device(monitor);
4ae388
 		if (!dev) {