diff mbox series

[lttng-tools,v3,5/8] Fix hang in thread_rotationwhen using compat-poll

Message ID 20190322181928.6186-5-ylamarre@efficios.com
State Superseded, archived
Delegated to: Jérémie Galarneau
Headers show
Series [lttng-tools,v3,1/8] Fix: lttng_poll_mod callscompat_(e)poll_add | expand

Commit Message

Yannick Lamarre March 22, 2019, 6:19 p.m. UTC
Add missing verification to prevent a blocking read on an empty fd.

Signed-off-by: Yannick Lamarre <ylamarre at efficios.com>
---
 src/bin/lttng-sessiond/rotation-thread.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/src/bin/lttng-sessiond/rotation-thread.c b/src/bin/lttng-sessiond/rotation-thread.c
index 6669372d..b86b1668 100644
--- a/src/bin/lttng-sessiond/rotation-thread.c
+++ b/src/bin/lttng-sessiond/rotation-thread.c
@@ -974,6 +974,10 @@  void *thread_rotation(void *data)
 			int fd = LTTNG_POLL_GETFD(&thread.events, i);
 			uint32_t revents = LTTNG_POLL_GETEV(&thread.events, i);
 
+			if (!revents) {
+				/* No activity for this FD (poll implementation). */
+				continue;
+			}
 			DBG("[rotation-thread] Handling fd (%i) activity (%u)",
 					fd, revents);