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

Jérémie Galarneau jeremie.galarneau at efficios.com
Tue Jan 22 15:13:16 EST 2019


Note that this patch was merged in stable-2.10 too.

Jérémie

On Wed, 12 Dec 2018 at 15:11, Mathieu Desnoyers
<mathieu.desnoyers at efficios.com> wrote:
>
> 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
>


-- 
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com


More information about the lttng-dev mailing list