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

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