X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=formats%2Fctf%2Fir%2Fevent-fields.c;h=4383e2a33783ee221af1115a493bf1845ff46c6a;hb=87b41f95af464c19d4fe9898cdca6bd53338ef04;hp=1092dc314d9d8ac08ab39476f39a5afcd1f16daa;hpb=8c1aa858878b64d103166be4c02f110af87669df;p=babeltrace.git diff --git a/formats/ctf/ir/event-fields.c b/formats/ctf/ir/event-fields.c index 1092dc31..4383e2a3 100644 --- a/formats/ctf/ir/event-fields.c +++ b/formats/ctf/ir/event-fields.c @@ -32,6 +32,7 @@ #include #include #include +#include #define PACKET_LEN_INCREMENT (getpagesize() * 8 * CHAR_BIT) @@ -233,14 +234,22 @@ struct bt_ctf_field *bt_ctf_field_create(struct bt_ctf_field_type *type) { struct bt_ctf_field *field = NULL; enum ctf_type_id type_id; + int ret; if (!type) { goto error; } type_id = bt_ctf_field_type_get_type_id(type); - if (type_id <= CTF_TYPE_UNKNOWN || type_id >= NR_CTF_TYPES || - bt_ctf_field_type_validate(type)) { + if (type_id <= CTF_TYPE_UNKNOWN || type_id >= NR_CTF_TYPES) { + goto error; + } + + /* Field class MUST be valid */ + ret = bt_ctf_field_type_validate(type); + + if (ret) { + /* Invalid */ goto error; } @@ -526,7 +535,8 @@ int bt_ctf_field_structure_set_field(struct bt_ctf_field *field, expected_field_type = bt_ctf_field_type_structure_get_field_type_by_name(field->type, name); - if (expected_field_type != value->type) { + + if (bt_ctf_field_type_compare(expected_field_type, value->type)) { ret = -1; goto end; } @@ -667,6 +677,7 @@ struct bt_ctf_field *bt_ctf_field_variant_get_field(struct bt_ctf_field *field, cur_tag_container = bt_ctf_field_enumeration_get_container(variant->tag); + assert(cur_tag_container); cur_tag_enum_integer = container_of(cur_tag_container, struct bt_ctf_field_integer, parent); bt_put(cur_tag_container); @@ -2170,9 +2181,13 @@ int increase_packet_size(struct ctf_stream_pos *pos) } pos->packet_size += PACKET_LEN_INCREMENT; - ret = posix_fallocate(pos->fd, pos->mmap_offset, - pos->packet_size / CHAR_BIT); + do { + ret = bt_posix_fallocate(pos->fd, pos->mmap_offset, + pos->packet_size / CHAR_BIT); + } while (ret == EINTR); if (ret) { + errno = EINTR; + ret = -1; goto end; }