From: David Goulet Date: Wed, 12 Mar 2014 21:08:32 +0000 (-0400) Subject: Fix: add error/msg output to save command X-Git-Tag: v2.5.0-rc1~107 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ab85fc7fad7ae208e310a4af6b753f6968a7fd60;p=lttng-tools.git Fix: add error/msg output to save command Signed-off-by: David Goulet --- diff --git a/src/bin/lttng/commands/save.c b/src/bin/lttng/commands/save.c index e7c3caeef..e8a4565e9 100644 --- a/src/bin/lttng/commands/save.c +++ b/src/bin/lttng/commands/save.c @@ -117,18 +117,27 @@ int cmd_save(int argc, const char **argv) goto end_destroy; } - if (lttng_save_session_attr_set_output_url(attr, - opt_output_path)) { + if (lttng_save_session_attr_set_output_url(attr, opt_output_path)) { ret = CMD_ERROR; goto end_destroy; } ret = lttng_save_session(attr); - if (ret) { - if (ret == -LTTNG_ERR_SESS_NOT_FOUND) { - ERR("Session '%s' not found", session_name); + if (ret < 0) { + ERR("%s", lttng_strerror(ret)); + } else { + /* Inform the user of what just happened on success. */ + if (session_name && opt_output_path) { + MSG("Session %s saved successfully in %s.", session_name, + opt_output_path); + } else if (session_name && !opt_output_path) { + MSG("Session %s saved successfully.", session_name); + } else if (!session_name && opt_output_path) { + MSG("All sessions have been saved successfully in %s.", + opt_output_path); + } else { + MSG("All sessions have been saved successfully."); } - ret = CMD_ERROR; } end_destroy: lttng_save_session_attr_destroy(attr);