commit c4c8426bbcb31717a2a45f96283d89c45024c832
parent 4642d21ffe85cbc88b28c446084dbaeb5753cd1f
Author: sin <sin@2f30.org>
Date: Mon, 7 Jul 2014 09:32:10 +0100
Don't rely on the programmer setting reload = 1
Don't rely on state variable change before calling reloadentries()
to correctly report warning.
Diffstat:
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/crond.c b/crond.c
@@ -333,11 +333,8 @@ loadentries(void)
TAILQ_INSERT_TAIL(&ctabhead, cte, entry);
}
- if (r < 0) {
- if (reload == 1)
- logwarn("warning: discarding old crontab entries\n");
+ if (r < 0)
unloadentries();
- }
free(line);
fclose(fp);
@@ -349,7 +346,8 @@ static void
reloadentries(void)
{
unloadentries();
- loadentries();
+ if (loadentries() < 0)
+ logwarn("warning: discarding old crontab entries\n");
}
static void