Fix: lay out names in exclusion structure correctly
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 26 Aug 2015 05:05:13 +0000 (01:05 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 3 Nov 2015 22:48:54 +0000 (17:48 -0500)
This:

    char names[0][LTTNG_SYMBOL_NAME_LEN];

means that accessing

    ->names[0][i]

will return the i-th character of the first name.
So doing:

    lttng enable-event -u -a --exclude hello,a,b,c,d
    lttng save

would result in a saved session XML file containing
this:

    <exclusion>hello</exclusion>
    <exclusion>ello</exclusion>
    <exclusion>llo</exclusion>
    <exclusion>lo</exclusion>
    <exclusion>o</exclusion>

This is great art, but not what is expected.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/save.c
src/common/sessiond-comm/sessiond-comm.h

index cc7bfe1e0c76fc778fd078feb7c97d2d4ace1486..065fb3f029c548184b470248824a84a95dd4c89e 100644 (file)
@@ -674,7 +674,7 @@ int save_ust_event(struct config_writer *writer,
                for (i = 0; i < event->exclusion->count; i++) {
                        ret = config_writer_write_element_string(writer,
                                config_element_exclusion,
-                               &event->exclusion->names[0][i]);
+                               &event->exclusion->names[i][0]);
                        if (ret) {
                                ret = LTTNG_ERR_SAVE_IO_FAIL;
                                goto end;
index 67d1bcfaf72e0677d1afd46e7e3e3604dea88d2b..1e0ee5d450004bfea111e36b2447cac4bae52842 100644 (file)
@@ -333,7 +333,7 @@ struct lttng_filter_bytecode {
 struct lttng_event_exclusion {
        uint32_t count;
        char padding[LTTNG_EVENT_EXCLUSION_PADDING];
-       char names[LTTNG_SYMBOL_NAME_LEN][0];
+       char names[0][LTTNG_SYMBOL_NAME_LEN];
 } LTTNG_PACKED;
 
 /*
This page took 0.027303 seconds and 4 git commands to generate.