scron

simple cron daemon
git clone git://git.2f30.org/scron.git
Log | Files | Refs | README | LICENSE

commit c9b050110ae469981ed7b93f0dd5ac577f2648e8
parent 27ba9583bbb12cf9544eb2c861eef80f15396260
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat Jul  5 14:02:50 +0000

crond: check errno for parsing numbers

Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>

Diffstat:
crond.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/crond.c b/crond.c @@ -11,6 +11,7 @@ #include <syslog.h> #include <time.h> #include <unistd.h> +#include <errno.h> #include "arg.h" #include "queue.h" @@ -191,16 +192,18 @@ parsefield(const char *field, int low, int high, struct field *f) switch (e1[0]) { case '-': e1++; + errno = 0; max = strtol(e1, &e2, 10); - if (e2[0] != '\0') + if (e2[0] != '\0' || errno != 0) return -1; break; case '*': e1++; if (e1[0] == '/') { e1++; + errno = 0; div = strtol(e1, &e2, 10); - if (e2[0] != '\0') + if (e2[0] != '\0' || errno != 0) return -1; break; }