From ec4c2b5ccbda1625a9011c27994186bf78cc9d72 Mon Sep 17 00:00:00 2001 From: Julien Desfossez Date: Mon, 12 Mar 2012 14:59:44 -0400 Subject: [PATCH] Fix error checking in bt_context_add_traces_recursive If a trace directory is inexistant or if the user doesn't have the permission to open the parent directory, bt_context_add_traces_recursive returned 0, now it returns -1. This function is not part of the API, so the programs who copied this function into their code should apply this fix as well. Fixes #103 Signed-off-by: Julien Desfossez Signed-off-by: Mathieu Desnoyers --- converter/babeltrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/converter/babeltrace.c b/converter/babeltrace.c index de9b4960..aadeb441 100644 --- a/converter/babeltrace.c +++ b/converter/babeltrace.c @@ -327,7 +327,7 @@ int bt_context_add_traces_recursive(struct bt_context *ctx, const char *path, GArray *trace_ids; char lpath[PATH_MAX]; char * const paths[2] = { lpath, NULL }; - int ret; + int ret = -1; /* * Need to copy path, because fts_open can change it. @@ -393,7 +393,7 @@ int bt_context_add_traces_recursive(struct bt_context *ctx, const char *path, } g_array_free(trace_ids, TRUE); - return 0; + return ret; error: return ret; -- 2.34.1