From 64cebb8b262f01b3f69513d29f9b3d4c10e0fcaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Marqu=C3=A9s?= Date: Tue, 19 Sep 2017 19:03:56 -0300 Subject: [PATCH] When searching for the path of the config file we were using config_file which is the value the user passes with the -f option. If the user didn't pass a value, this variable will have a value of NULL. The variable which has the correct path is config_file_path, which will have the same value provided by config_file if it's a valid file, or the file if found in one of the default locations. --- repmgrd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/repmgrd.c b/repmgrd.c index 914767f5..892e6f5a 100644 --- a/repmgrd.c +++ b/repmgrd.c @@ -479,11 +479,11 @@ daemonize_process(void) memset(path, 0, MAXPGPATH); - for (ptr = config_file + strlen(config_file); ptr > config_file; --ptr) + for (ptr = config_file_path + strlen(config_file_path); ptr > config_file_path; --ptr) { if (*ptr == '/') { - strncpy(path, config_file, ptr - config_file); + strncpy(path, config_file_path, ptr - config_file_path); } }