Fix: run_command_wait() handle partial write
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 13 Dec 2018 18:56:35 +0000 (13:56 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 21 Jan 2019 21:29:26 +0000 (16:29 -0500)
Use lttng_write() to handle partial writes (writing 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-commands.c

index cca667476b2efffd32ac520ba1e764198a538328..dc782e2934f27a4b6bed48249223a2b55aab5e4a 100644 (file)
@@ -44,9 +44,9 @@ int run_command_wait(struct notification_thread_handle *handle,
        cds_list_add_tail(&cmd->cmd_list_node,
                        &handle->cmd_queue.list);
        /* Wake-up thread. */
-       ret = write(lttng_pipe_get_writefd(handle->cmd_queue.event_pipe),
+       ret = lttng_write(lttng_pipe_get_writefd(handle->cmd_queue.event_pipe),
                        &notification_counter, sizeof(notification_counter));
-       if (ret < 0) {
+       if (ret != sizeof(notification_counter)) {
                PERROR("write to notification thread's queue event fd");
                /*
                 * Remove the command from the list so the notification
This page took 0.027426 seconds and 5 git commands to generate.