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

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