X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fdestroy.c;h=be0261d11b760b67561b52d324334c35f39162e7;hp=cac1e96fd8d1f9655f67adf084833880673027a8;hb=3285a971b225891df3dc7c2796176ce1f94665fe;hpb=13e3b28009f1f922da6021e43254db86b78aa109 diff --git a/src/bin/lttng/commands/destroy.c b/src/bin/lttng/commands/destroy.c index cac1e96fd..be0261d11 100644 --- a/src/bin/lttng/commands/destroy.c +++ b/src/bin/lttng/commands/destroy.c @@ -155,7 +155,7 @@ static int destroy_session(struct lttng_session *session) goto error; } if (ret_code != LTTNG_OK) { - ret = -LTTNG_OK; + ret = -ret_code; goto error; } @@ -228,23 +228,27 @@ error: */ static int destroy_all_sessions(struct lttng_session *sessions, int count) { - int i, ret = CMD_SUCCESS; + int i; + bool error_occurred = false; + assert(count >= 0); 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]); + int ret = destroy_session(&sessions[i]); + if (ret < 0) { - goto error; + ERR("%s during the destruction of session \"%s\"", + lttng_strerror(ret), + sessions[i].name); + /* Continue to next session. */ + error_occurred = true; } } -error: - return ret; + + return error_occurred ? CMD_ERROR : CMD_SUCCESS; } /* @@ -350,8 +354,10 @@ int cmd_destroy(int argc, const char **argv) command_ret = destroy_session(&sessions[i]); if (command_ret) { success = 0; + ERR("%s during the destruction of session \"%s\"", + lttng_strerror(command_ret), + sessions[i].name); } - } }