diff --git a/THANKS b/THANKS index 8fe47e0..2639556 100644 --- a/THANKS +++ b/THANKS @@ -50,3 +50,4 @@ Brent Swingle Mathieu Morier Jean Benoit Belkacem Daheb +Björn Lässig diff --git a/src/getdata.c b/src/getdata.c index 966fe5d..ff05804 100644 --- a/src/getdata.c +++ b/src/getdata.c @@ -238,8 +238,14 @@ void parse_config(struct conf_t *state, const int is_include, const char *restri shared_p->name = state->shared_net_root->name; /* Open configuration file */ dhcpd_config = fopen(config_file, "r"); - if (dhcpd_config == NULL) + if (dhcpd_config == NULL) { + if (is_include) { + error(0, errno, "cannot open inlude: %s", config_file); + return; + } + /* config if from command line, just exit with error */ error(EXIT_FAILURE, errno, "parse_config: %s", config_file); + } #ifdef HAVE_POSIX_FADVISE # ifdef POSIX_FADV_SEQUENTIAL if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) diff --git a/tests/expected/errors b/tests/expected/errors index b85e282..6903ac6 100644 --- a/tests/expected/errors +++ b/tests/expected/errors @@ -7,7 +7,16 @@ dhcpd-pools: unknown color mode: 'sometimes' === IPv5 dhcpd-pools: unknown --ip-version argument: 5 === missing conf -dhcpd-pools: parse_config: ./tests/confs/complete_NXFILE: No such file or directory +dhcpd-pools: cannot open inlude: ./tests/confs/complete_NXFILE: No such file or directory +Ranges: +shared net name first ip last ip max cur percent touch t+c t+c perc + +Shared networks: +name max cur percent touch t+c t+c perc + +Sum of all ranges: +name max cur percent touch t+c t+c perc +All networks 0 0 nan 0 0 nan === missing leases dhcpd-pools: parse_leases: ./tests/leases/complete_NXFILE: No such file or directory === html table