[lttng-dev] [PATCH babeltrace] Fix: Ensure the specified input format is CTF

Jérémie Galarneau jeremie.galarneau at efficios.com
Thu Feb 28 18:30:12 EST 2013


Add a check to make sure the input trace format argument passed to the
babeltrace converter is "ctf" as it is currently the only one supported.

Add a note to this effect in the man page.

Fixes #462

Signed-off-by: Jérémie Galarneau <jeremie.galarneau at efficios.com>
---
 converter/babeltrace.c | 2 +-
 doc/babeltrace.1       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/converter/babeltrace.c b/converter/babeltrace.c
index 20ded00..6847248 100644
--- a/converter/babeltrace.c
+++ b/converter/babeltrace.c
@@ -607,7 +607,7 @@ int main(int argc, char **argv)
 		}
 	}
 	fmt_read = bt_lookup_format(g_quark_from_static_string(opt_input_format));
-	if (!fmt_read) {
+	if (!fmt_read || fmt_read->name != g_quark_from_static_string("ctf")) {
 		fprintf(stderr, "[error] Format \"%s\" is not supported.\n\n",
 			opt_input_format);
 		partial_error = 1;
diff --git a/doc/babeltrace.1 b/doc/babeltrace.1
index 3196299..78e9055 100644
--- a/doc/babeltrace.1
+++ b/doc/babeltrace.1
@@ -29,7 +29,7 @@ Input trace FILE(s) or directory(ies)
 Output trace path (default: stdout)
 .TP
 .BR "-i, --input-format FORMAT"
-Input trace format (default: ctf)
+Input trace format (default: ctf). CTF is currently the only supported input format.
 .TP
 .BR "-o, --output-format FORMAT"
 Output trace format (default: text)
-- 
1.8.1.4




More information about the lttng-dev mailing list