Handle packets containing only a header
[babeltrace.git] / formats / ctf / ctf.c
index 794e428c51d069a97354826b17f0f391afbafcbf..5cf8097ce709892580c49957cf4751f9bc2e753b 100644 (file)
@@ -471,6 +471,15 @@ int ctf_read_event(struct bt_stream_pos *ppos, struct ctf_stream_definition *str
         */
        if (unlikely(pos->offset == EOF))
                return EOF;
+
+       if (pos->content_size == 0) {
+               /* Stream is inactive for now (live reading). */
+               return EAGAIN;
+       }
+       /* Packet only contains headers */
+       if (pos->offset == pos->content_size)
+               return EAGAIN;
+
        assert(pos->offset < pos->content_size);
 
        /* Read event header */
This page took 0.024998 seconds and 4 git commands to generate.