#define TSDL_MAGIC 0x75d11d57
-BT_HIDDEN
+extern
int yydebug;
struct ctf_metadata_decoder {
/* Close stream, which also flushes the buffer */
ret = bt_close_memstream(buf, &size, out_fp);
+ /*
+ * See fclose(3). Further access to out_fp after both success
+ * and error, even through another bt_close_memstream(), results
+ * in undefined behavior. Nullify out_fp to ensure we don't
+ * fclose it twice on error.
+ */
+ out_fp = NULL;
if (ret < 0) {
BT_LOGE("Cannot close memory stream: %s: mdec-addr=%p",
strerror(errno), mdec);
struct ctf_metadata_decoder_config default_config = {
.clock_class_offset_s = 0,
.clock_class_offset_ns = 0,
- .strict = false,
};
if (!config) {
BT_LOGD("Creating CTF metadata decoder: "
"clock-class-offset-s=%" PRId64 ", "
- "clock-class-offset-ns=%" PRId64 ", "
- "strict=%d, name=\"%s\"",
+ "clock-class-offset-ns=%" PRId64 ", name=\"%s\"",
config->clock_class_offset_s, config->clock_class_offset_ns,
- config->strict, name);
+ name);
if (!mdec) {
BT_LOGE_STR("Failed to allocate one CTF metadata decoder.");
BT_LOGD("Creating CTF metadata decoder: "
"clock-class-offset-s=%" PRId64 ", "
"clock-class-offset-ns=%" PRId64 ", "
- "strict=%d, name=\"%s\", addr=%p",
+ "name=\"%s\", addr=%p",
config->clock_class_offset_s, config->clock_class_offset_ns,
- config->strict, name, mdec);
+ name, mdec);
end:
return mdec;
BT_LOGD("Metadata stream is plain text: mdec-addr=%p", mdec);
+ if (init_pos < 0) {
+ BT_LOGE_ERRNO("Failed to get current file position", ".");
+ status = CTF_METADATA_DECODER_STATUS_ERROR;
+ goto end;
+ }
+
/* Check text-only metadata header and version */
nr_items = fscanf(fp, "/* CTF %10u.%10u", &major, &minor);
if (nr_items < 2) {