From: Marek Vavrusa Date: Fri, 22 Jan 2016 07:40:26 +0000 (-0800) Subject: daemon: "-c -" doesn't ready any configuration X-Git-Tag: v1.0.0-beta3~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05331a569e7722146a4e1928f30f0f159876274b;p=thirdparty%2Fknot-resolver.git daemon: "-c -" doesn't ready any configuration this includes default configuration, resolver starts completely blank --- diff --git a/daemon/engine.c b/daemon/engine.c index 7e4fc8b25..1f3bbed25 100644 --- a/daemon/engine.c +++ b/daemon/engine.c @@ -69,6 +69,7 @@ static int l_help(lua_State *L) "cache\n network configuration\n" "modules\n modules configuration\n" "kres\n resolver services\n" + "trust_anchors\n configure trust anchors\n" ; lua_pushstring(L, help_str); return 1; @@ -570,6 +571,9 @@ static int engine_loadconf(struct engine *engine, const char *config_path) return kr_error(ENOEXEC); } /* Load config file */ + if (strcmp(config_path, "-") == 0) { + return ret; /* No config, no defaults. */ + } if(access(config_path, F_OK ) != -1 ) { ret = l_dosandboxfile(engine->L, config_path); } diff --git a/daemon/main.c b/daemon/main.c index 065765760..b9c395cac 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -324,7 +324,7 @@ int main(int argc, char **argv) kr_log_error("[system] rundir '%s': %s\n", rundir, strerror(errno)); return EXIT_FAILURE; } - if(config && access(config, R_OK) != 0) { + if(config && strcmp(config, "-") != 0 && access(config, R_OK) != 0) { kr_log_error("[system] rundir '%s'\n", rundir); kr_log_error("[system] config '%s': %s\n", config, strerror(errno)); return EXIT_FAILURE;