From: Wouter Wijngaards Date: Thu, 14 Feb 2008 10:37:32 +0000 (+0000) Subject: start without a config file (all default settings). X-Git-Tag: release-0.10~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94f8dd838ca5ae2b611f9fcb35846c6de714e58b;p=thirdparty%2Funbound.git start without a config file (all default settings). git-svn-id: file:///svn/unbound/trunk@953 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/daemon/unbound.c b/daemon/unbound.c index d0829b8b9..fe9187cbf 100644 --- a/daemon/unbound.c +++ b/daemon/unbound.c @@ -354,8 +354,12 @@ run_daemon(char* cfgfile, int cmdline_verbose, int debug_mode) /* config stuff */ if(!(cfg = config_create())) fatal_exit("Could not alloc config defaults"); - if(!config_read(cfg, cfgfile)) - fatal_exit("Could not read config file: %s", cfgfile); + if(!config_read(cfg, cfgfile)) { + if(errno != ENOENT) + fatal_exit("Could not read config file: %s", + cfgfile); + log_warn("Continuing with default config settings"); + } apply_settings(daemon, cfg, cmdline_verbose); /* prepare */ diff --git a/doc/Changelog b/doc/Changelog index 85e043d4a..e9c19991a 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,7 @@ +14 February 2008: Wouter + - start without a config file (will complain, but start with + defaults). + 13 February 2008: Wouter - 0.9 released. - 1.0 development. Printout ldns version on unbound -h. diff --git a/util/config_file.c b/util/config_file.c index ceb40b246..7262ce499 100644 --- a/util/config_file.c +++ b/util/config_file.c @@ -357,6 +357,7 @@ config_read(struct config_file* cfg, char* filename) if(cfg_parser->errors != 0) { fprintf(stderr, "read %s failed: %d errors in configuration file\n", cfg_parser->filename, cfg_parser->errors); + errno=EINVAL; return 0; } return 1; diff --git a/util/config_file.h b/util/config_file.h index c52cc1665..de27de4e6 100644 --- a/util/config_file.h +++ b/util/config_file.h @@ -255,7 +255,8 @@ struct config_file* config_create_forlib(); * Read the config file from the specified filename. * @param config: where options are stored into, must be freshly created. * @param filename: name of configfile. If NULL nothing is done. - * @return: false on error. + * @return: false on error. In that case errno is set, ENOENT means + * file not found. */ int config_read(struct config_file* config, char* filename);