Writer fix: set packet size to 0 on flush failure
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 3 Feb 2017 02:21:26 +0000 (21:21 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 28 May 2017 16:57:37 +0000 (12:57 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
formats/ctf/ir/stream.c

index 845153c13399a190b35dd17392c7af840ae180b6..96da8af3ce43aa7b3a68feb34aded7c4c3e8f275 100644 (file)
@@ -1059,6 +1059,16 @@ end:
                                "content_size");
        }
        bt_put(integer);
+
+       if (ret < 0) {
+               /*
+                * We failed to write the packet. Its size is therefore set to 0
+                * to ensure the next mapping is done in the same place rather
+                * than advancing by "stream->pos.packet_size", which would
+                * leave a corrupted packet in the trace.
+                */
+               stream->pos.packet_size = 0;
+       }
        return ret;
 }
 
This page took 0.024679 seconds and 4 git commands to generate.