- if (opt_session_name == NULL) {
- config_destroy(path);
- MSG("Session %s destroyed at %s", session_name, path);
- } else {
- MSG("Session %s destroyed", session_name);
+/*
+ * destroy_all_sessions
+ *
+ * Call destroy_sessions for each registered sessions
+ */
+static int destroy_all_sessions()
+{
+ int count, i, ret = CMD_SUCCESS;
+ struct lttng_session *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;