Fix: ctf-text: don't close stdout
[babeltrace.git] / formats / ctf-text / ctf-text.c
index cd691250f417515ebd0fd64dea1ad12aef3125e5..b87718b58ddecabeaa66f7f6de0cfc3bc3701404 100644 (file)
@@ -135,7 +135,7 @@ struct ctf_callsite_dups *ctf_trace_callsite_lookup(struct ctf_trace *trace,
                        (gpointer) (unsigned long) callsite_name);
 }
 
-int print_field(struct definition *definition)
+int print_field(struct bt_definition *definition)
 {
        /* Print all fields in verbose mode */
        if (babeltrace_verbose)
@@ -597,10 +597,12 @@ int ctf_text_close_trace(struct bt_trace_descriptor *td)
        int ret;
        struct ctf_text_stream_pos *pos =
                container_of(td, struct ctf_text_stream_pos, trace_descriptor);
-       ret = fclose(pos->fp);
-       if (ret) {
-               perror("Error on fclose");
-               return -1;
+       if (pos->fp != stdout) {
+               ret = fclose(pos->fp);
+               if (ret) {
+                       perror("Error on fclose");
+                       return -1;
+               }
        }
        g_free(pos);
        return 0;
This page took 0.02528 seconds and 4 git commands to generate.