X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;ds=sidebyside;f=formats%2Fctf%2Fir%2Fstream.c;h=c0b4e979a9ff9195b21e323bc7402110cafe335e;hb=92cbbcc5ffb90362b3616beea9a615a55c768b37;hp=979d40e92839fd94f066bad1d8d226e5153e170b;hpb=0686ef9496b70a2b1e401375ca6ffd529c4b2a34;p=babeltrace.git diff --git a/formats/ctf/ir/stream.c b/formats/ctf/ir/stream.c index 979d40e9..c0b4e979 100644 --- a/formats/ctf/ir/stream.c +++ b/formats/ctf/ir/stream.c @@ -884,12 +884,18 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) goto end; } - empty_packet = (stream->events->len == 0); - ret = bt_ctf_field_validate(stream->packet_header); - if (ret) { + if (!stream->packet_context && stream->flushed_packet_count > 0) { + /* + * A stream without a packet context, and thus without + * content and packet size members, can't have more than + * one packet. + */ + ret = -1; goto end; } + empty_packet = (stream->events->len == 0); + /* mmap the next packet */ ctf_packet_seek(&stream->pos.parent, 0, SEEK_CUR);