Launch the rotation thread using lttng_thread
[lttng-tools.git] / src / bin / lttng-sessiond / agent.c
index 6841d41928660be42594fe8c6b8a0dc08cc6d300..3b8acd2a2a0a57093c0d9822c7180a67f310b005 100644 (file)
@@ -29,7 +29,7 @@
 #include "agent.h"
 #include "ust-app.h"
 #include "utils.h"
-#include "error.h"
+#include "common/error.h"
 
 #define AGENT_RET_CODE_INDEX(code) (code - AGENT_RET_CODE_SUCCESS)
 
@@ -143,11 +143,18 @@ static int ht_match_event(struct cds_lfht_node *node,
        }
 
        /* Filter expression */
-       if (strncmp(event->filter_expression, key->filter_expression,
-                       strlen(event->filter_expression)) != 0) {
+       if (!!event->filter_expression != !!key->filter_expression) {
+               /* One has a filter expression, the other does not */
                goto no_match;
        }
 
+       if (event->filter_expression) {
+               if (strncmp(event->filter_expression, key->filter_expression,
+                               strlen(event->filter_expression)) != 0) {
+                       goto no_match;
+               }
+       }
+
        return 1;
 
 no_match:
@@ -353,8 +360,11 @@ static ssize_t list_events(struct agent_app *app, struct lttng_event **events)
 
        for (i = 0; i < nb_event; i++) {
                offset += len;
-               strncpy(tmp_events[i].name, reply->payload + offset,
-                               sizeof(tmp_events[i].name));
+               if (lttng_strncpy(tmp_events[i].name, reply->payload + offset,
+                               sizeof(tmp_events[i].name))) {
+                       ret = LTTNG_ERR_INVALID;
+                       goto error;
+               }
                tmp_events[i].pid = app->pid;
                tmp_events[i].enabled = -1;
                len = strlen(reply->payload + offset) + 1;
This page took 0.02416 seconds and 4 git commands to generate.