Port: Add Solaris string compat
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.c
index b866f73a6b53535557502ae00fee548bfc07e539..b4521dfe3be28c63a083035b27ed121ad4dfbdd5 100644 (file)
@@ -18,7 +18,6 @@
 #define _GNU_SOURCE
 #define _LGPL_SOURCE
 #include <assert.h>
-#include <string.h>
 #include <inttypes.h>
 #include <urcu/list.h>
 #include <urcu/uatomic.h>
@@ -28,6 +27,7 @@
 #include <common/sessiond-comm/sessiond-comm.h>
 #include <common/relayd/relayd.h>
 #include <common/utils.h>
+#include <common/compat/string.h>
 
 #include "channel.h"
 #include "consumer.h"
@@ -1048,7 +1048,7 @@ int cmd_enable_channel(struct ltt_session *session,
        assert(attr);
        assert(domain);
 
-       len = strnlen(attr->name, sizeof(attr->name));
+       len = lttng_strnlen(attr->name, sizeof(attr->name));
 
        /* Validate channel name */
        if (attr->name[0] == '.' ||
@@ -1280,10 +1280,12 @@ int cmd_disable_event(struct ltt_session *session,
 
                switch (event->type) {
                case LTTNG_EVENT_ALL:
-                       if (strlen(event->name) == 1 &&
-                                       !strncmp(event->name, "*", 1)) {
-                               ret = event_ust_disable_all_tracepoints(usess,
-                                               uchan);
+                       /*
+                        * An empty event name means that everything
+                        * should be disabled.
+                        */
+                       if (event->name[0] == '\0') {
+                               ret = event_ust_disable_all_tracepoints(usess, uchan);
                        } else {
                                ret = event_ust_disable_tracepoint(usess, uchan,
                                                event_name);
@@ -1323,8 +1325,11 @@ int cmd_disable_event(struct ltt_session *session,
                        ret = -LTTNG_ERR_UST_EVENT_NOT_FOUND;
                        goto error_unlock;
                }
-               /* The wild card * means that everything should be disabled. */
-               if (strncmp(event->name, "*", 1) == 0 && strlen(event->name) == 1) {
+               /*
+                * An empty event name means that everything
+                * should be disabled.
+                */
+               if (event->name[0] == '\0') {
                        ret = event_agent_disable_all(usess, agt);
                } else {
                        ret = event_agent_disable(usess, agt, event_name);
This page took 0.024566 seconds and 4 git commands to generate.