Fix: deny overwrite mode and num subbuf less than 2
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.c
index eb516d3b10c7cbf724c7f7b4c4090db24a510274..2536dc72da28051f9edb6204c834a3b179a5c8fd 100644 (file)
@@ -933,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.023388 seconds and 4 git commands to generate.