X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fdestroy.c;h=3fb5fb232edb16184a4a7574de9b6e623668959f;hb=27babd3a0a164f71d4dc02884ef20099ddfc6755;hp=cdc2c538c597eb4a33b82fde72bd2af0597e4ff5;hpb=f9cd0dcde5fb24b3872aea0ba248e1dcab602ff7;p=lttng-tools.git diff --git a/src/bin/lttng/commands/destroy.c b/src/bin/lttng/commands/destroy.c index cdc2c538c..3fb5fb232 100644 --- a/src/bin/lttng/commands/destroy.c +++ b/src/bin/lttng/commands/destroy.c @@ -49,11 +49,12 @@ static struct poptOption long_options[] = { */ static void usage(FILE *ofp) { - fprintf(ofp, "usage: lttng destroy [options] [NAME]\n"); + fprintf(ofp, "usage: lttng destroy [NAME] [OPTIONS]\n"); fprintf(ofp, "\n"); fprintf(ofp, "Where NAME is an optional session name. If not specified, lttng will\n"); fprintf(ofp, "get it from the configuration directory (.lttng).\n"); fprintf(ofp, "\n"); + fprintf(ofp, "Options:\n"); fprintf(ofp, " -h, --help Show this help\n"); fprintf(ofp, " -a, --all Destroy all sessions\n"); fprintf(ofp, " --list-options Simple listing of options\n"); @@ -73,10 +74,11 @@ static int destroy_session(const char *session_name) ret = lttng_destroy_session(session_name); if (ret < 0) { switch (-ret) { - case LTTCOMM_SESS_NOT_FOUND: + case LTTNG_ERR_SESS_NOT_FOUND: WARN("Session name %s not found", session_name); break; default: + ERR("%s", lttng_strerror(ret)); break; } goto error; @@ -102,7 +104,11 @@ static int destroy_all_sessions() count = lttng_list_sessions(&sessions); if (count == 0) { MSG("No session found, nothing to do."); + } else if (count < 0) { + ERR("%s", lttng_strerror(ret)); + goto error; } + for (i = 0; i < count; i++) { ret = destroy_session(sessions[i].name); if (ret < 0) {