Fix: consumer snapshot: handle unsigned long overflow
[lttng-tools.git] / src / common / ust-consumer / ust-consumer.c
index 73d27b57b04effa5ad3307576e3b1461be63699c..94b761cb8fc19fa532b4a485c178b4ac93aaee54 100644 (file)
@@ -1168,7 +1168,7 @@ static int snapshot_channel(struct lttng_consumer_channel *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;
 
@@ -2026,7 +2026,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
 
                if (pending < 0) {
                        /*
-                        * An error occured while running the command;
+                        * An error occurred while running the command;
                         * don't send the 'pending' flag as the sessiond
                         * will not read it.
                         */
@@ -2070,7 +2070,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
 
                if (pending < 0) {
                        /*
-                        * An error occured while running the command;
+                        * An error occurred while running the command;
                         * don't send the 'pending' flag as the sessiond
                         * will not read it.
                         */
This page took 0.024615 seconds and 4 git commands to generate.