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 <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2017-11-12 15:22:46 +00:00
parent 5a8c178924
commit a237c11d5a
No known key found for this signature in database
GPG key ID: A9553245FDE9B739

View file

@ -276,6 +276,8 @@ static char *must_read_template(const char *filename)
struct stat s; struct stat s;
char *result; char *result;
if (filename == NULL)
error(EXIT_FAILURE, 0, "must_read_template: --mustach argument missing");
if ((f = open(filename, O_RDONLY)) < 0) { if ((f = open(filename, O_RDONLY)) < 0) {
error(EXIT_FAILURE, errno, "must_read_template: open: %s", filename); error(EXIT_FAILURE, errno, "must_read_template: open: %s", filename);
} }