start without a config file (all default settings).

git-svn-id: file:///svn/unbound/trunk@953 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2008-02-14 10:37:32 +00:00
parent ed224e1d64
commit 94f8dd838c
4 changed files with 13 additions and 3 deletions

View file

@ -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 */

View file

@ -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.

View file

@ -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;

View file

@ -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);