Skip to contentSkip to conversation

Fix: handle_notification_thread_command: handle partial read

PATCH New Mathieu Desnoyers 2 participants 3 messages Dec 12, 2018 – Jan 22, 2019 2 messages 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

PATCH 2/2 Fix: handle_notification_thread_command: handle partial read

Use lttng_read() to handle partial reads (returning less than the requested amount of bytes) as well as ret = -1, errno == EINTR.

---
 src/bin/lttng-sessiond/notification-thread-events.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/bin/lttng-sessiond/notification-thread-events.c +2 -2
index 3482a7e8..9cc91cc4 100644
@@ -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;
 	}
 
Signature · 1 line
2.11.0
#2 lore raw

Re: [PATCH lttng-tools 1/2] Fix: notification thread: free session trigger list on error

In reply to a message not in the archive

Both patches were merged in master and stable-2.11.

Thanks!
Jérémie

Quoted 21 lines · Mathieu Desnoyers
---
 src/bin/lttng-sessiond/notification-thread-events.c | 1 +
 1 file changed, 1 insertion(+)
src/bin/lttng-sessiond/notification-thread-events.c +1 -1
index ba4e5a05..3482a7e8 100644
@@ -1518,6 +1518,7 @@ struct session_info *find_or_create_session_info(
        if (!session) {
                ERR("[notification-thread] Failed to allocation session info for session \"%s\" (uid = %i, gid = %i)",
                                name, uid, gid);
+               lttng_session_trigger_list_destroy(trigger_list);
                goto error;
        }
        trigger_list = NULL;
--

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

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

#4 lore raw

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

Jérémie

Quoted 28 lines · Mathieu Desnoyers

Use lttng_read() to handle partial reads (returning less than the requested amount of bytes) as well as ret = -1, errno == EINTR.

---
 src/bin/lttng-sessiond/notification-thread-events.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/bin/lttng-sessiond/notification-thread-events.c +2 -3
index 3482a7e8..9cc91cc4 100644
@@ -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

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