mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 18:25:07 -05:00
sourcestats: return success when loading dump file with no samples
This commit is contained in:
@@ -866,7 +866,7 @@ SST_LoadFromFile(SST_Stats inst, FILE *in)
|
||||
|
||||
if (fgets(line, sizeof(line), in) &&
|
||||
sscanf(line, "%d", &inst->n_samples) == 1 &&
|
||||
inst->n_samples > 0 && inst->n_samples <= MAX_SAMPLES) {
|
||||
inst->n_samples >= 0 && inst->n_samples <= MAX_SAMPLES) {
|
||||
|
||||
for (i=0; i<inst->n_samples; i++) {
|
||||
if (!fgets(line, sizeof(line), in) ||
|
||||
@@ -903,6 +903,9 @@ SST_LoadFromFile(SST_Stats inst, FILE *in)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!inst->n_samples)
|
||||
return 1;
|
||||
|
||||
inst->last_sample = inst->n_samples - 1;
|
||||
inst->runs_samples = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user