X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=formats%2Fctf%2Fir%2Fstream.c;fp=formats%2Fctf%2Fir%2Fstream.c;h=96da8af3ce43aa7b3a68feb34aded7c4c3e8f275;hp=845153c13399a190b35dd17392c7af840ae180b6;hb=cd7d8fb7b8a599187c9d0e479969c86cf5640397;hpb=c9af50d1314b590a1ffc32de5c4135348dbbec9a diff --git a/formats/ctf/ir/stream.c b/formats/ctf/ir/stream.c index 845153c1..96da8af3 100644 --- a/formats/ctf/ir/stream.c +++ b/formats/ctf/ir/stream.c @@ -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; }