aboutsummaryrefslogtreecommitdiff
path: root/lib/cron
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-10-10 11:28:46 +0200
committerDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-10-10 16:45:11 +0200
commit24c90b7700e18d0668799f8f343bc854a42dea20 (patch)
tree224d9b5e81a46e27f354c6975fc3fa4cd1f1fb79 /lib/cron
parent7b647eefef00afb6104e84fae2a2fbf0481d4364 (diff)
Configuration parser cleanup
- Do a getline() & process in rdline instead of doing a read per character and feeding it through a state machine. - Move splitkv to rdcfg.c, the only place where it is used Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'lib/cron')
-rw-r--r--lib/cron/rdcron.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/cron/rdcron.c b/lib/cron/rdcron.c
index 1c11cbb..520f969 100644
--- a/lib/cron/rdcron.c
+++ b/lib/cron/rdcron.c
@@ -486,7 +486,8 @@ crontab_t *rdcron(int dirfd, const char *filename)
cron = calloc(1, sizeof(*cron));
if (cron == NULL) {
fputs("out of memory\n", stderr);
- goto out;
+ close(fd);
+ return NULL;
}
cron->minute = 0xFFFFFFFFFFFFFFFFUL;
@@ -501,7 +502,6 @@ crontab_t *rdcron(int dirfd, const char *filename)
delcron(cron);
cron = NULL;
}
-out:
- close(fd);
+ rdline_cleanup(&rd);
return cron;
}