- (void) bt_ctf_stream_pos_fini(&stream->pos);
-
- if (stream->pos.fd >= 0) {
- int ret;
-
- /*
- * Truncate the file's size to the minimum required to fit the
- * last packet as we might have grown it too much on the last
- * mmap.
- */
- do {
- ret = ftruncate(stream->pos.fd, stream->size);
- } while (ret == -1 && errno == EINTR);
- if (ret) {
- BT_LOGE_ERRNO("Failed to truncate stream file",
- ": ret=%d, size=%" PRIu64,
- ret, (uint64_t) stream->size);
- }
-
- if (close(stream->pos.fd)) {
- BT_LOGE_ERRNO("Failed to close stream file",
- ": ret=%d", ret);
- }
- }