From a905b50943e93db917b785d07cb6eebd3e2efff8 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 8 Jan 2017 11:49:41 +0000 Subject: [PATCH] getdata: report position in config file when parsing fails It seems that one can reach the abort() with severely broken configuration file, that is extremely unlikely to run without parser error when given to ISC dhcpd. So such files ought to be impossible, and it is good enough for this software to report position where parsing cannot be continued. Signed-off-by: Sami Kerola --- src/getdata.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/getdata.c b/src/getdata.c index 05adee5..906fa27 100644 --- a/src/getdata.c +++ b/src/getdata.c @@ -257,8 +257,9 @@ void parse_config(int is_include, const char *restrict config_file, break; } else if (argument == ITS_A_RANGE_SECOND_IP && i == 0) { if (!range_p) { - puts("parse_config: range_p uninitialized: report a bug"); - abort(); + fpos_t pos; + fgetpos(dhcpd_config, &pos); + error(EXIT_FAILURE, 0, "parse_config: parsing failed at position: %Ld", pos); } range_p->last_ip = range_p->first_ip; goto newrange;