projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix handling of memopen size
[babeltrace.git]
/
formats
/
ctf
/
ctf.c
diff --git
a/formats/ctf/ctf.c
b/formats/ctf/ctf.c
index 13232692b6be62720bd918b75c7873f28dac5264..e84e19d870e0d5bd1531e8cdb9266effa2d6806b 100644
(file)
--- a/
formats/ctf/ctf.c
+++ b/
formats/ctf/ctf.c
@@
-457,7
+457,11
@@
int ctf_open_trace_metadata_packet_read(struct ctf_trace *td, FILE *in,
ret = -EINVAL;
break;
}
ret = -EINVAL;
break;
}
- printf("read %s\n", buf);
+ if (babeltrace_debug) {
+ fprintf(stdout, "[debug] metadata packet read: %s\n",
+ buf);
+ }
+
writelen = fwrite(buf, sizeof(char), readlen, out);
if (writelen < readlen) {
ret = -EIO;
writelen = fwrite(buf, sizeof(char), readlen, out);
if (writelen < readlen) {
ret = -EIO;
@@
-485,6
+489,11
@@
int ctf_open_trace_metadata_stream_read(struct ctf_trace *td, FILE **fp,
int ret;
in = *fp;
int ret;
in = *fp;
+ /*
+ * Using strlen on *buf instead of size of open_memstream
+ * because its size includes garbage at the end (after final
+ * \0). This is the allocated size, not the actual string size.
+ */
out = open_memstream(buf, &size);
if (out == NULL)
return -errno;
out = open_memstream(buf, &size);
if (out == NULL)
return -errno;
@@
-502,7
+511,7
@@
int ctf_open_trace_metadata_stream_read(struct ctf_trace *td, FILE **fp,
fclose(out); /* flush the buffer */
fclose(in);
/* open for reading */
fclose(out); /* flush the buffer */
fclose(in);
/* open for reading */
- *fp = fmemopen(*buf, s
ize
, "rb");
+ *fp = fmemopen(*buf, s
trlen(*buf)
, "rb");
return 0;
}
return 0;
}
This page took
0.024199 seconds
and
4
git commands to generate.