- dirfd = open(node->fts_accpath, 0);
- if (dirfd < 0) {
- fprintf(stderr, "[error] [Context] Unable to open trace "
- "directory file descriptor.\n");
- ret = dirfd;
- goto error;
- }
- metafd = openat(dirfd, "metadata", O_RDONLY);
- if (metafd < 0) {
- ret = close(dirfd);
- if (ret < 0) {
- perror("close");
- goto error;
- }
- } else {
- int trace_id;
-
- ret = close(metafd);
- if (ret < 0) {
- perror("close");
- goto error;
- }
- ret = close(dirfd);
- if (ret < 0) {
- perror("close");
- goto error;
- }
-
- trace_id = bt_context_add_trace(ctx,
- node->fts_accpath, format_str);
- if (trace_id < 0) {
- fprintf(stderr, "[error] [Context] opening trace \"%s\" from %s "
- "for reading.\n", node->fts_accpath, path);
- ret = trace_id;
- goto error;
- }
- g_array_append_val(trace_ids, trace_id);
- }
+error_collection_del:
+ /* Remove from containers */
+ bt_trace_collection_remove(handle->td->ctx->tc, handle->td);
+error_destroy_handle:
+ bt_trace_handle_destroy(handle);
+error_close:
+ closeret = fmt->close_trace(td);
+ if (closeret) {
+ fprintf(stderr, "Error in close_trace callback\n");