From a237c11d5a351125ae6ee6bcf2d02ee183a16374 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 12 Nov 2017 15:22:46 +0000 Subject: [PATCH] output: improve mustach template parsing error Following error did not inform clearly what is wrong. $ ./dhcpd-pools -l samples/dhcpd.leases -c samples/dhcpd.conf -fm ./dhcpd-pools: must_read_template: open: (null): Bad address Signed-off-by: Sami Kerola --- src/mustach-dhcpd-pools.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mustach-dhcpd-pools.c b/src/mustach-dhcpd-pools.c index 54a2009..90e09e5 100644 --- a/src/mustach-dhcpd-pools.c +++ b/src/mustach-dhcpd-pools.c @@ -276,6 +276,8 @@ static char *must_read_template(const char *filename) struct stat s; char *result; + if (filename == NULL) + error(EXIT_FAILURE, 0, "must_read_template: --mustach argument missing"); if ((f = open(filename, O_RDONLY)) < 0) { error(EXIT_FAILURE, errno, "must_read_template: open: %s", filename); }