From 24c90b7700e18d0668799f8f343bc854a42dea20 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 10 Oct 2018 11:28:46 +0200 Subject: 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 --- lib/cron/rdcron.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/cron/rdcron.c') 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; } -- cgit v1.2.3