Fix error checking in bt_context_add_traces_recursive
authorJulien Desfossez <julien.desfossez@efficios.com>
Mon, 12 Mar 2012 18:59:44 +0000 (14:59 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 12 Mar 2012 18:59:44 +0000 (14:59 -0400)
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 <julien.desfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
converter/babeltrace.c

index de9b49600fc5e0543690bc2104bfc6f194195e82..aadeb441cf18ed81fa4a43b14d77e8d27389af72 100644 (file)
@@ -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;
This page took 0.025238 seconds and 4 git commands to generate.