Fix: handle_notification_thread_command: handle partial read
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 12 Dec 2018 20:11:15 +0000 (15:11 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 14 Jan 2019 22:56:28 +0000 (17:56 -0500)
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@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/notification-thread-events.c

index 3482a7e89509b697743fd62d57baa7c7bbc26c90..9cc91cc4006615b0d3aa171cec01e2d3ee8faec8 100644 (file)
@@ -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;
        }
 
This page took 0.026961 seconds and 4 git commands to generate.