HomeClusterLabs Projects

storage_mon: Fix bug in checking of number of specified scores.

Description

storage_mon: Fix bug in checking of number of specified scores.

Previously specifying the maximum allowed number (MAX_DEVICES, currently 25)
of devices and scores as arguments could cause storage_mon to fail unexpectedly
with the error message "too many scores, max is 25". This issue happened
because storage_mon checked whether the number of specified scores
exceeded the upper limit by using the local variable "device_count" indicating
the number of specified devices (not scores). So after the maximum number
of devices arguments were interpreted, the appearance of next score argument
caused the error even when the number of interpreted scores arguments had
not exceeded the maximum.

This patch fixes storage_mon so that it uses the local variable "score_count"
indicating the number of specified scores, to check whether arguments for
scores are specified more than the upper limit.

Details

Provenance
Fujii Masao <fujii@postgresql.org>Authored on Jul 19 2022, 7:28 AM
Parents
rRf021a7f731a5: storage_mon: make -h exit just after printing help message (#1791)
Branches
Unknown
Tags
Unknown

Event Timeline

Fujii Masao <fujii@postgresql.org> committed rRa68957e8f1e8: storage_mon: Fix bug in checking of number of specified scores. (authored by Fujii Masao <fujii@postgresql.org>).Jul 19 2022, 7:28 AM