Fix: deny overwrite mode and num subbuf less than 2
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.c
index bb9329f308ac90d56dd28c0e66254a3378b0022b..2536dc72da28051f9edb6204c834a3b179a5c8fd 100644 (file)
@@ -166,6 +166,8 @@ static void list_lttng_channels(int domain, struct ltt_session *session,
                        channels[i].attr.read_timer_interval =
                                uchan->attr.read_timer_interval;
                        channels[i].enabled = uchan->enabled;
+                       channels[i].attr.tracefile_size = uchan->tracefile_size;
+                       channels[i].attr.tracefile_count = uchan->tracefile_count;
                        switch (uchan->attr.output) {
                        case LTTNG_UST_MMAP:
                        default:
@@ -931,6 +933,16 @@ int cmd_enable_channel(struct ltt_session *session,
                attr->attr.switch_timer_interval = 0;
        }
 
+       /*
+        * The ringbuffer (both in user space and kernel) behave badly in overwrite
+        * mode and with less than 2 subbuf so block it right away and send back an
+        * invalid attribute error.
+        */
+       if (attr->attr.overwrite && attr->attr.num_subbuf < 2) {
+               ret = LTTNG_ERR_INVALID;
+               goto error;
+       }
+
        switch (domain->type) {
        case LTTNG_DOMAIN_KERNEL:
        {
This page took 0.023044 seconds and 4 git commands to generate.