[lttng-dev] [PATCH lttng-tools 2/2] Fix: handle_notification_thread_command: handle partial read

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Wed Dec 12 15:11:15 EST 2018


Use lttng_read() to handle partial reads (returning less than the
requested amount of bytes) as well as ret = -1, errno == EINTR.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 src/bin/lttng-sessiond/notification-thread-events.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/bin/lttng-sessiond/notification-thread-events.c b/src/bin/lttng-sessiond/notification-thread-events.c
index 3482a7e8..9cc91cc4 100644
--- a/src/bin/lttng-sessiond/notification-thread-events.c
+++ b/src/bin/lttng-sessiond/notification-thread-events.c
@@ -2277,9 +2277,9 @@ int handle_notification_thread_command(
 	struct notification_thread_command *cmd;
 
 	/* Read the event pipe to put it back into a quiescent state. */
-	ret = read(lttng_pipe_get_readfd(handle->cmd_queue.event_pipe), &counter,
+	ret = lttng_read(lttng_pipe_get_readfd(handle->cmd_queue.event_pipe), &counter,
 			sizeof(counter));
-	if (ret == -1) {
+	if (ret != sizeof(counter)) {
 		goto error;
 	}
 
-- 
2.11.0



More information about the lttng-dev mailing list