From: Jérémie Galarneau Date: Sun, 11 Dec 2016 10:52:30 +0000 (-0500) Subject: Fix: handle size 0 CTF fs streams X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=9fa0891acd0694a596cf8d3df18cd9615f409590;p=deliverable%2Fbabeltrace.git Fix: handle size 0 CTF fs streams Signed-off-by: Jérémie Galarneau --- diff --git a/plugins/ctf/fs/data-stream.c b/plugins/ctf/fs/data-stream.c index 366250973..ca5b47e8d 100644 --- a/plugins/ctf/fs/data-stream.c +++ b/plugins/ctf/fs/data-stream.c @@ -120,15 +120,6 @@ enum bt_ctf_notif_iter_medium_status medop_request_bytes( goto end; } - /* Check if we need an initial memory map */ - if (!stream->mmap_addr) { - if (mmap_next(stream)) { - PERR("Cannot memory-map initial region of file \"%s\" (%p)\n", - stream->file->path->str, stream->file->fp); - goto error; - } - } - /* Check if we have at least one memory-mapped byte left */ if (remaining_mmap_bytes(stream) == 0) { /* Are we at the end of the file? */ diff --git a/plugins/ctf/fs/fs.c b/plugins/ctf/fs/fs.c index 3a60b0d5e..71ae52b07 100644 --- a/plugins/ctf/fs/fs.c +++ b/plugins/ctf/fs/fs.c @@ -554,6 +554,12 @@ int open_trace_streams(struct ctf_fs_component *ctf_fs, goto error; } + if (file->size == 0) { + /* Skip empty stream. */ + ctf_fs_file_destroy(file); + continue; + } + /* Create a private stream; file ownership is passed to it. */ stream = ctf_fs_stream_create(ctf_fs, file); if (!stream) {