]> git.ipfire.org Git - pakfire.git/commitdiff
log buffer: Reset pointers when there is no more data
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 24 Dec 2024 13:24:38 +0000 (13:24 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 24 Dec 2024 13:24:38 +0000 (13:24 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/log_buffer.c

index c525904c15003cca87c2d1700721a08006ae714e..1852e6f0d7ec0db145fa30cca00fc00ad1c7098f 100644 (file)
@@ -155,8 +155,16 @@ int pakfire_log_buffer_dequeue(struct pakfire_log_buffer* buffer, int* priority,
 
        // Fetch the first line
        l = STAILQ_FIRST(&buffer->lines);
-       if (!l)
+       if (!l) {
+               // Reset all pointers
+               *priority = -1;
+               *line = NULL;
+
+               if (length)
+                       *length = -1;
+
                return 0;
+       }
 
        // Return the priority
        *priority = l->priority;