X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fsave.c;h=9be710326349150a08bd9da5d5999152a777c6ab;hb=59b41aa2b4d4f74cefb898c9a45e82194ee7ff15;hp=e7c3caeefb2e6dce8de041c7bf4e9c73e6888628;hpb=c864d6d788c58de94111911a9e10d221ec8bc398;p=lttng-tools.git diff --git a/src/bin/lttng/commands/save.c b/src/bin/lttng/commands/save.c index e7c3caeef..9be710326 100644 --- a/src/bin/lttng/commands/save.c +++ b/src/bin/lttng/commands/save.c @@ -93,12 +93,9 @@ int cmd_save(int argc, const char **argv) if (!opt_save_all) { session_name = poptGetArg(pc); - if (!session_name) { - ERR("A session name must be provided if the \"all\" option is not used."); - ret = CMD_ERROR; - goto end; + if (session_name) { + DBG2("Session name: %s", session_name); } - DBG2("Session name: %s", session_name); } attr = lttng_save_session_attr_create(); @@ -117,18 +114,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);