Fix: handle size 0 CTF fs streams
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 11 Dec 2016 10:52:30 +0000 (05:52 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 27 May 2017 18:09:08 +0000 (14:09 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
plugins/ctf/fs/data-stream.c
plugins/ctf/fs/fs.c

index 366250973308a0cfee6348b7a46ac62a3f62d637..ca5b47e8d3383064b72b7d44277891cf3a7457a6 100644 (file)
@@ -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? */
index 3a60b0d5e40d4dd632658c73fed9b30f7290bcb1..71ae52b079cae414ef1c69ce20fcdefe8866a95a 100644 (file)
@@ -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) {
This page took 0.027779 seconds and 4 git commands to generate.