ctf writer BSD compatibily: remove O_DIRECTORY
[babeltrace.git] / formats / ctf / writer / writer.c
index d0fad8fbb0ab5d3fde5b0753b1f419839ade0418..5600a92a0a1debd22cfed2066edf5ee16bfae825 100644 (file)
@@ -115,8 +115,7 @@ struct bt_ctf_writer *bt_ctf_writer_create(const char *path)
                goto error_destroy;
        }
 
-       writer->trace_dir_fd = open(path, O_RDONLY | O_DIRECTORY,
-               S_IRWXU | S_IRWXG);
+       writer->trace_dir_fd = open(path, O_RDONLY, S_IRWXU | S_IRWXG);
        if (writer->trace_dir_fd < 0) {
                perror("open");
                goto error_destroy;
@@ -168,11 +167,17 @@ void bt_ctf_writer_destroy(struct bt_ctf_ref *ref)
        }
 
        if (writer->trace_dir_fd > 0) {
-               close(writer->trace_dir_fd);
+               if (close(writer->trace_dir_fd)) {
+                       perror("close");
+                       abort();
+               }
        }
 
        if (writer->metadata_fd > 0) {
-               close(writer->metadata_fd);
+               if (close(writer->metadata_fd)) {
+                       perror("close");
+                       abort();
+               }
        }
 
        if (writer->environment) {
@@ -356,6 +361,7 @@ void append_trace_metadata(struct bt_ctf_writer *writer,
                struct metadata_context *context)
 {
        unsigned char *uuid = writer->uuid;
+       int ret;
 
        g_string_append(context->string, "trace {\n");
 
@@ -374,7 +380,9 @@ void append_trace_metadata(struct bt_ctf_writer *writer,
        g_string_append(context->string, "\tpacket.header := ");
        context->current_indentation_level++;
        g_string_assign(context->field_name, "");
-       bt_ctf_field_type_serialize(writer->trace_packet_header_type, context);
+       ret = bt_ctf_field_type_serialize(writer->trace_packet_header_type,
+               context);
+       assert(!ret);
        context->current_indentation_level--;
 
        g_string_append(context->string, ";\n};\n\n");
This page took 0.027622 seconds and 4 git commands to generate.