From e7bc4a5d3103f745cad575a3acf48baf27a4d762 Mon Sep 17 00:00:00 2001 From: Niklas Schnelle Date: Mon, 4 May 2026 13:41:34 +0200 Subject: [PATCH] opticsmon: Enforce 1 second as minimal interval MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: c34adb9cabee ("opticsmon: Introduce opticsmon tool") Reviewed-by: Jan Höppner Signed-off-by: Niklas Schnelle Signed-off-by: Jan Höppner --- opticsmon/opticsmon.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opticsmon/opticsmon.c b/opticsmon/opticsmon.c index c50275d4..f86056d4 100644 --- a/opticsmon/opticsmon.c +++ b/opticsmon/opticsmon.c @@ -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();