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

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