From: Mathieu Desnoyers Date: Wed, 12 Dec 2018 20:11:15 +0000 (-0500) Subject: Fix: handle_notification_thread_command: handle partial read X-Git-Tag: v2.12.0-rc1~677 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=18aeca0536f05906bf4364bc831fd7c769f60608 Fix: handle_notification_thread_command: handle partial read 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 Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/notification-thread-events.c b/src/bin/lttng-sessiond/notification-thread-events.c index 3482a7e89..9cc91cc40 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; }