From: Mathieu Desnoyers Date: Thu, 13 Dec 2018 18:56:35 +0000 (-0500) Subject: Fix: run_command_wait() handle partial write X-Git-Tag: v2.12.0-rc1~675 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=58d3fed5a62a82ce8487dce41a3092e79a9bca15;hp=a5d64ae7893cc1d2b595614a8f8e3d03c401cf39 Fix: run_command_wait() handle partial write 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 Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/notification-thread-commands.c b/src/bin/lttng-sessiond/notification-thread-commands.c index 11275ffc0..129cf4ee2 100644 --- a/src/bin/lttng-sessiond/notification-thread-commands.c +++ b/src/bin/lttng-sessiond/notification-thread-commands.c @@ -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), ¬ification_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