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.11.0-rc2~90 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=5ca61505aee955dcf5bf93b3ce5a1da20a6066d2;p=lttng-tools.git 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; }