Fix sink.ctf.fs: NULL dereference in logging statement
[babeltrace.git] / plugins / ctf / fs-src / data-stream-file.c
index 0ca01a61606f67c5d831c7568bc42bc2dbf58916..76ea9ad502939758176908b41e15c09a54650901 100644 (file)
@@ -63,10 +63,11 @@ int ds_file_munmap(struct ctf_fs_ds_file *ds_file)
        }
 
        if (bt_munmap(ds_file->mmap_addr, ds_file->mmap_len)) {
-               BT_LOGE("Cannot memory-unmap address %p (size %zu) of file \"%s\" (%p): %s",
+               BT_LOGE_ERRNO("Cannot memory-unmap file",
+                       ": address=%p, size=%zu, file_path=\"%s\", file=%p",
                        ds_file->mmap_addr, ds_file->mmap_len,
-                       ds_file->file->path->str, ds_file->file->fp,
-                       strerror(errno));
+                       ds_file->file->path->str,
+                       ds_file->file ? ds_file->file->fp : NULL);
                ret = -1;
                goto end;
        }
@@ -110,9 +111,9 @@ enum bt_ctf_notif_iter_medium_status ds_file_mmap_next(
                        PROT_READ, MAP_PRIVATE, fileno(ds_file->file->fp),
                        ds_file->mmap_offset);
        if (ds_file->mmap_addr == MAP_FAILED) {
-               BT_LOGE("Cannot memory-map address (size %zu) of file \"%s\" (%p) at offset %zu: %s",
+               BT_LOGE("Cannot memory-map address (size %zu) of file \"%s\" (%p) at offset %jd: %s",
                                ds_file->mmap_len, ds_file->file->path->str,
-                               ds_file->file->fp, ds_file->mmap_offset,
+                               ds_file->file->fp, (intmax_t) ds_file->mmap_offset,
                                strerror(errno));
                goto error;
        }
@@ -176,7 +177,8 @@ end:
 
 static
 struct bt_ctf_stream *medop_get_stream(
-               struct bt_ctf_stream_class *stream_class, void *data)
+               struct bt_ctf_stream_class *stream_class, uint64_t stream_id,
+               void *data)
 {
        struct ctf_fs_ds_file *ds_file = data;
        struct bt_ctf_stream_class *ds_file_stream_class;
This page took 0.024731 seconds and 4 git commands to generate.