Fix: return an error if no trace can be opened
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 24 Apr 2012 15:50:43 +0000 (11:50 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 24 Apr 2012 15:50:43 +0000 (11:50 -0400)
Fixes #222

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
converter/babeltrace.c

index 11c10cf8aa488657ac9fae1fcd0ac9e98d01525e..c377935edb4eee708113d50dd86ac5e6c54edb1a 100644 (file)
@@ -400,10 +400,15 @@ int bt_context_add_traces_recursive(struct bt_context *ctx, const char *path,
                }
        }
 
                }
        }
 
-       g_array_free(trace_ids, TRUE);
-       return ret;
-
 error:
 error:
+       /*
+        * Return an error if no trace can be opened.
+        */
+       if (ret == 0 && trace_ids->len == 0) {
+               fprintf(stderr, "[error] Cannot open any trace for reading.\n\n");
+               ret = -ENOENT;
+       }
+       g_array_free(trace_ids, TRUE);
        return ret;
 }
 
        return ret;
 }
 
This page took 0.033332 seconds and 4 git commands to generate.