... even if rundir isn't specified. No other changes in semantics.
Before this a typo in config path would pass silently.
+Knot Resolver 1.3.2 (2017-07-xx)
+================================
+
+Bugfixes
+--------
+- daemon: check existence of config file even if rundir isn't specified
+
+
Knot Resolver 1.3.1 (2017-06-23)
================================
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 ) {
+ if (config_path) {
+ if (strcmp(config_path, "-") == 0) {
+ return ret; /* No config and no defaults. */
+ }
ret = l_dosandboxfile(engine->L, config_path);
}
if (ret == 0) {
int engine_pcall(struct lua_State *L, int argc);
int engine_ipc(struct engine *engine, const char *expr);
+
+/** Start the lua engine and execute the config.
+ *
+ * @note Special path "-" means that even default config won't be done
+ * (like listening on localhost).
+ */
int engine_start(struct engine *engine, const char *config_path);
void engine_stop(struct engine *engine);
int engine_register(struct engine *engine, const char *module, const char *precedence, const char* ref);
int engine_unregister(struct engine *engine, const char *module);
void engine_lualib(struct engine *engine, const char *name, int (*lib_cb) (struct lua_State *));
+
/** Return engine light userdata. */
struct engine *engine_luaget(struct lua_State *L);
kr_log_error("[system] rundir '%s': %s\n", rundir, strerror(errno));
return EXIT_FAILURE;
}
- 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;
- }
}
+
+ if (config && strcmp(config, "-") != 0 && access(config, R_OK) != 0) {
+ kr_log_error("[system] config '%s': %s\n", config, strerror(errno));
+ return EXIT_FAILURE;
+ }
+ if (!config && access("config", R_OK) == 0) {
+ config = "config";
+ }
+
#ifndef CAN_FORK_EARLY
/* Forking is currently broken with libuv. We need libuv to bind to
* sockets etc. before forking, but at the same time can't touch it before
worker->loop = loop;
loop->data = worker;
- ret = engine_start(&engine, config ? config : "config");
+ ret = engine_start(&engine, config);
if (ret != 0) {
ret = EXIT_FAILURE;
goto cleanup;