projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Handle correctly cross-endianness for text-based metadata
[babeltrace.git]
/
formats
/
ctf
/
metadata
/
ctf-visitor-generate-io-struct.c
diff --git
a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
index fcb73838ddc4abebe740284a4f80a5eb5593cc71..bba15b684ffcc9bf3fa6abbeea56e9550cbb7897 100644
(file)
--- a/
formats/ctf/metadata/ctf-visitor-generate-io-struct.c
+++ b/
formats/ctf/metadata/ctf-visitor-generate-io-struct.c
@@
-1898,9
+1898,17
@@
int ctf_trace_declaration_visit(FILE *fd, int depth, struct ctf_node *node, stru
ret = -EPERM;
goto error;
} else {
ret = -EPERM;
goto error;
} else {
- trace->byte_order = byte_order;
+ CTF_TRACE_SET_FIELD(trace, byte_order);
+ if (byte_order != trace->byte_order) {
+ trace->byte_order = byte_order;
+ /*
+ * We need to restart
+ * construction of the
+ * intermediate representation.
+ */
+ return -EINTR;
+ }
}
}
- CTF_TRACE_SET_FIELD(trace, byte_order);
} else if (!strcmp(left, "packet.header")) {
struct declaration *declaration;
} else if (!strcmp(left, "packet.header")) {
struct declaration *declaration;
@@
-1946,6
+1954,7
@@
int ctf_trace_visit(FILE *fd, int depth, struct ctf_node *node, struct ctf_trace
int ret = 0;
struct ctf_node *iter;
int ret = 0;
struct ctf_node *iter;
+restart:
if (trace->declaration_scope)
return -EEXIST;
trace->declaration_scope = new_declaration_scope(trace->root_declaration_scope);
if (trace->declaration_scope)
return -EEXIST;
trace->declaration_scope = new_declaration_scope(trace->root_declaration_scope);
@@
-1992,6
+2001,10
@@
error:
declaration_unref(&trace->packet_header_decl->p);
g_ptr_array_free(trace->streams, TRUE);
free_declaration_scope(trace->declaration_scope);
declaration_unref(&trace->packet_header_decl->p);
g_ptr_array_free(trace->streams, TRUE);
free_declaration_scope(trace->declaration_scope);
+ trace->declaration_scope = NULL;
+ /* byte order changed while creating types, retry. */
+ if (ret == -EINTR)
+ goto restart;
return ret;
}
return ret;
}
This page took
0.025779 seconds
and
4
git commands to generate.