goto error;
}
if (ret_code != LTTNG_OK) {
- ret = -LTTNG_OK;
+ ret = -ret_code;
goto error;
}
status = lttng_destruction_handle_get_rotation_state(handle,
&rotation_state);
+ if (status != LTTNG_DESTRUCTION_HANDLE_STATUS_OK) {
+ ERR("Failed to get rotation state from destruction handle");
+ goto skip_wait_rotation;
+ }
switch (rotation_state) {
case LTTNG_ROTATION_STATE_NO_ROTATION:
break;
*/
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;
}
/*
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);
}
-
}
}