bug-mcron
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] fix parsing of "--schedule" option without value


From: François J
Subject: [PATCH] fix parsing of "--schedule" option without value
Date: Wed, 26 Jan 2022 13:31:24 +0100

Help message states that default value for "-s" option was "8" but the
predicate used in getopt-long definition triggered a crash if value was
not passed.

* src/mcron/scripts/mcron.scm (main): change predicate for --schedule option
---
 src/mcron/scripts/mcron.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mcron/scripts/mcron.scm b/src/mcron/scripts/mcron.scm
index a6b1fa2..d4336f6 100644
--- a/src/mcron/scripts/mcron.scm
+++ b/src/mcron/scripts/mcron.scm
@@ -118,7 +118,8 @@ directory. Double-check the folder and file permissions and 
syntax."))))
                             (predicate ,(λ (in) (or (string=? in "guile")
                                                     (string=? in "vixie")))))
                   (schedule (single-char #\s) (value optional)
-                            (predicate ,string->number))
+                            (predicate ,(λ (s) (or (eqv? #t s)
+                                                   (string->number s)))))
                   (help     (single-char #\?))
                   (version  (single-char #\V))))))
 
-- 
2.32.0



reply via email to

[Prev in Thread] Current Thread [Next in Thread]