]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
start without a config file (all default settings).
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 14 Feb 2008 10:37:32 +0000 (10:37 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 14 Feb 2008 10:37:32 +0000 (10:37 +0000)
git-svn-id: file:///svn/unbound/trunk@953 be551aaa-1e26-0410-a405-d3ace91eadb9

daemon/unbound.c
doc/Changelog
util/config_file.c
util/config_file.h

index d0829b8b922a34ed851497494161c8a799046129..fe9187cbf03206a56ff304b35ae188b6724455f8 100644 (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 */
index 85e043d4acef2df095aefbf1fbb3045ec07de192..e9c19991a1eb91f5b108d9cc0949e17f2b6c33ed 100644 (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.
index ceb40b24631de25e0bf5c66388177abc778500aa..7262ce4992af88c8305cb3bb8b0afbb12bb63a00 100644 (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;
index c52cc1665f01e733fdae244b83ab970bd5894ca5..de27de4e6529f6103b874edc06e96553422dc77c 100644 (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);