Skip padding from metadata end of packet
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 3 Aug 2011 17:38:17 +0000 (13:38 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 3 Aug 2011 17:38:17 +0000 (13:38 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
formats/ctf/ctf.c

index fee9a5578d809de68f233c2b855980a6f1fb0173..23a2179bbf19851bb4685143df0c3301a4e2959d 100644 (file)
@@ -568,10 +568,19 @@ int ctf_open_trace_metadata_packet_read(struct ctf_trace *td, FILE *in,
                toread -= readlen;
                if (!toread) {
                        ret = 0;        /* continue reading next packet */
-                       break;
+                       goto read_padding;
                }
        }
        return ret;
+
+read_padding:
+       toread = (header.packet_size - header.content_size) / CHAR_BIT;
+       ret = fseek(in, toread, SEEK_CUR);
+       if (ret < 0) {
+               fprintf(stdout, "[warning] Missing padding at end of file\n");
+               ret = 0;
+       }
+       return ret;
 }
 
 static
This page took 0.024526 seconds and 4 git commands to generate.