-
- if (ret && babeltrace_output_fd >= 0) {
- char *line;
- size_t len = METADATA_LINE_SIZE;
- FILE *babeltrace_output_fp = NULL;
-
- babeltrace_output_fp = fdopen(babeltrace_output_fd, "r");
- if (!babeltrace_output_fp) {
- perror("fdopen on babeltrace_output_fd");
- goto close_fp;
- }
- babeltrace_output_fd = -1;
-
- line = malloc(len);
- if (!line) {
- diag("malloc error");
- }
- rewind(babeltrace_output_fp);
- while (bt_getline(&line, &len, babeltrace_output_fp) > 0) {
- diag("%s", line);
- }
-
- free(line);
-close_fp:
- if (babeltrace_output_fp) {
- if (fclose(babeltrace_output_fp)) {
- diag("fclose error");
- }
- }
- }
-
- if (babeltrace_output_fd >= 0) {
- if (close(babeltrace_output_fd)) {
- diag("close error");
- }
- }