[dm-devel] [PATCH 17/72] libmultipath: uevent_listen(): fix poll() retval check
Martin Wilck
Martin.Wilck at suse.com
Sat Oct 12 21:27:58 UTC 2019
From: Martin Wilck <mwilck at suse.com>
Only check revents if poll() returns a positive value.
Signed-off-by: Martin Wilck <mwilck at suse.com>
---
libmultipath/uevent.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
index 8f7b2ef5..f128ced2 100644
--- a/libmultipath/uevent.c
+++ b/libmultipath/uevent.c
@@ -853,7 +853,7 @@ int uevent_listen(struct udev *udev)
poll_timeout = timeout * 1000;
errno = 0;
fdcount = poll(&ev_poll, 1, poll_timeout);
- if (fdcount && ev_poll.revents & POLLIN) {
+ if (fdcount > 0 && ev_poll.revents & POLLIN) {
timeout = uevent_burst(&start_time, events + 1) ? 1 : 0;
dev = udev_monitor_receive_device(monitor);
if (!dev) {
--
2.23.0
More information about the dm-devel
mailing list