From 4237f14a8a294912d5c8e3d96590a6f9005fad4b Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 17 Feb 2014 12:14:19 +0100 Subject: [PATCH] Get absoulte config file path before processig 'dir'. The code tried to obtain the configuration file absolute path after processing the configuration file. However if config file was a relative path and a "dir" statement was processed reading the config, the absolute path obtained was wrong. With this fix the absolute path is obtained before processing the configuration while the server is still in the original directory where it was executed. --- src/redis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/redis.c b/src/redis.c index d091ff37..d8a1e5ea 100644 --- a/src/redis.c +++ b/src/redis.c @@ -3030,10 +3030,10 @@ int main(int argc, char **argv) { } j++; } + if (configfile) server.configfile = getAbsolutePath(configfile); resetServerSaveParams(); loadServerConfig(configfile,options); sdsfree(options); - if (configfile) server.configfile = getAbsolutePath(configfile); } else { redisLog(REDIS_WARNING, "Warning: no config file specified, using the default config. In order to specify a config file use %s /path/to/%s.conf", argv[0], server.sentinel_mode ? "sentinel" : "redis"); } -- GitLab