Skip to contentSkip to conversation

Fix: run_command_wait() handle partial write

PATCH Jérémie Galarneau 1 participant 1 message Jan 22, 2019 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Merged in master, stable-2.11, and stable-2.10.

Thanks,
Jérémie

Quoted 28 lines · Mathieu Desnoyers

Use lttng_write() to handle partial writes (writing less than the requested amount of bytes) as well as ret = -1, errno = EINTR.

---
 src/bin/lttng-sessiond/notification-thread-commands.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/bin/lttng-sessiond/notification-thread-commands.c +2 -3
index 11275ffc..129cf4ee 100644
@@ -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
--

2.11.0

Signature · 7 lines
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev