X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Frotate.c;h=d9871dc9d3e9f6c651126f917d765321adc116f2;hp=5c5b1b70cc05b2eecee78809cce1309d716b9a14;hb=ed9f1fb24a21b222c23684cdf8e77b4d21c21895;hpb=66ea93b10c703e1b3dda1e17109eed9138e4ece2 diff --git a/src/lib/lttng-ctl/rotate.c b/src/lib/lttng-ctl/rotate.c index 5c5b1b70c..d9871dc9d 100644 --- a/src/lib/lttng-ctl/rotate.c +++ b/src/lib/lttng-ctl/rotate.c @@ -302,6 +302,9 @@ enum lttng_rotation_status lttng_rotation_update_schedule( status = lttng_rotation_schedule_size_threshold_get_threshold( schedule, &lsm.u.rotation_set_schedule.value); if (status != LTTNG_ROTATION_STATUS_OK) { + if (status == LTTNG_ROTATION_STATUS_UNAVAILABLE) { + status = LTTNG_ROTATION_STATUS_INVALID; + } goto end; } @@ -313,6 +316,9 @@ enum lttng_rotation_status lttng_rotation_update_schedule( status = lttng_rotation_schedule_periodic_get_period( schedule, &lsm.u.rotation_set_schedule.value); if (status != LTTNG_ROTATION_STATUS_OK) { + if (status == LTTNG_ROTATION_STATUS_UNAVAILABLE) { + status = LTTNG_ROTATION_STATUS_INVALID; + } goto end; } @@ -468,7 +474,8 @@ lttng_rotation_schedule_size_threshold_get_threshold( enum lttng_rotation_status status = LTTNG_ROTATION_STATUS_OK; struct lttng_rotation_schedule_size_threshold *size_schedule; - if (!schedule || !size_threshold_bytes) { + if (!schedule || !size_threshold_bytes || + schedule->type != LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD) { status = LTTNG_ROTATION_STATUS_INVALID; goto end; } @@ -495,7 +502,8 @@ lttng_rotation_schedule_size_threshold_set_threshold( struct lttng_rotation_schedule_size_threshold *size_schedule; if (!schedule || size_threshold_bytes == 0 || - size_threshold_bytes == -1ULL) { + size_threshold_bytes == -1ULL || + schedule->type != LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD) { status = LTTNG_ROTATION_STATUS_INVALID; goto end; } @@ -532,7 +540,8 @@ lttng_rotation_schedule_periodic_get_period( enum lttng_rotation_status status = LTTNG_ROTATION_STATUS_OK; struct lttng_rotation_schedule_periodic *periodic_schedule; - if (!schedule || !period_us) { + if (!schedule || !period_us || + schedule->type != LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC) { status = LTTNG_ROTATION_STATUS_INVALID; goto end; } @@ -558,7 +567,8 @@ lttng_rotation_schedule_periodic_set_period( enum lttng_rotation_status status = LTTNG_ROTATION_STATUS_OK; struct lttng_rotation_schedule_periodic *periodic_schedule; - if (!schedule || period_us == 0 || period_us == -1ULL) { + if (!schedule || period_us == 0 || period_us == -1ULL || + schedule->type != LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC) { status = LTTNG_ROTATION_STATUS_INVALID; goto end; }