Fix: consumer snapshot: handle unsigned long overflow
[lttng-tools.git] / src / common / kernel-consumer / kernel-consumer.c
index 246ae6b59dedc6182b1628aef8065a686959bbbc..627cd2a8b5d7aad61ffc1d97794a0c2bbf756267 100644 (file)
@@ -144,7 +144,8 @@ static int lttng_kconsumer_snapshot_channel(
 
        /* Splice is not supported yet for channel snapshot. */
        if (channel->output != CONSUMER_CHANNEL_MMAP) {
-               ERR("Unsupported output %d", channel->output);
+               ERR("Unsupported output type for channel \"%s\": mmap output is required to record a snapshot",
+                               channel->name);
                ret = -1;
                goto end;
        }
@@ -236,7 +237,7 @@ static int lttng_kconsumer_snapshot_channel(
                                produced_pos, nb_packets_per_stream,
                                stream->max_sb_size);
 
-               while (consumed_pos < produced_pos) {
+               while ((long) (consumed_pos - produced_pos) < 0) {
                        ssize_t read_len;
                        unsigned long len, padded_len;
 
This page took 0.023187 seconds and 4 git commands to generate.