Clean-up: lttng: check status returned when checking rotation state
[lttng-tools.git] / src / bin / lttng / commands / destroy.c
index e52735f439a453067f6099c59ba7a594891a72b4..cac1e96fd8d1f9655f67adf084833880673027a8 100644 (file)
@@ -101,7 +101,7 @@ static int destroy_session(struct lttng_session *session)
                                        fflush(stdout);
                                }
 
-                               usleep(DEFAULT_DATA_AVAILABILITY_WAIT_TIME);
+                               usleep(DEFAULT_DATA_AVAILABILITY_WAIT_TIME_US);
                                _MSG(".");
                                fflush(stdout);
                        }
@@ -127,7 +127,7 @@ static int destroy_session(struct lttng_session *session)
 
        do {
                status = lttng_destruction_handle_wait_for_completion(handle,
-                               DEFAULT_DATA_AVAILABILITY_WAIT_TIME);
+                               DEFAULT_DATA_AVAILABILITY_WAIT_TIME_US / USEC_PER_MSEC);
                switch (status) {
                case LTTNG_DESTRUCTION_HANDLE_STATUS_TIMEOUT:
                        if (!printed_wait_msg) {
@@ -161,6 +161,10 @@ static int destroy_session(struct lttng_session *session)
 
        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;
This page took 0.023275 seconds and 4 git commands to generate.