opticsmon: Enforce 1 second as minimal interval

So far it was possible for the user to specify an interval of 0 which
would result in not re-arming the timer at all thus disabling interval
based data collection. While this would still do optics data collection
on startup and link changes the intention is to collect data at least
every 24 hours. If interval is given as 0 treat this as minimum update
interval of 1 second.

Fixes: c34adb9cab ("opticsmon: Introduce opticsmon tool")
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Niklas Schnelle
2026-05-04 13:41:34 +02:00
committed by Jan Höppner
parent 8b38bf37b0
commit e7bc4a5d31

View File

@@ -96,6 +96,8 @@ static void parse_cmdline(int argc, char *argv[], struct options *opts)
}
if (seconds < 86400)
opts->interval_seconds = seconds;
if (seconds < 1)
opts->interval_seconds = 1;
break;
case 'h':
util_prg_print_help();