---
cron.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/cron.c b/cron.c
index e95c661..9da0c8a 100644
--- a/cron.c
+++ b/cron.c
@@ -287,19 +287,17 @@ parserange(char *str, long low, long high, struct range
*r)
r->repeat = strtol(repeat, &e, 10);
if (*e || errno != 0 || r->repeat == 0)
return -1;
+ } else if (random) {
+ r->repeat = r->low;
} else {
r->repeat = 1;
}
- if (random) {
- /* random replaces low in matchentry() */
- r->repeat = r->low; /* so that it doesn't repeat */
+ if (random)
r->low = rng32_bounded(r->high - r->low+1) + r->low;
- }
- if (r->low < low || r->low > high || r->high < low || r->high > high ||
r->repeat < low || r->repeat > high) {
+ if (r->low < low || r->low > high || r->high < low || r->high > high ||
r->repeat < low || r->repeat > high)
return -1;
- }
return 0;
}
--
2.44.0