mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-23 07:06:30 +00:00
Parse config file before daemonizing
Daemonizing changes the current working directory to '/', which breaks configuration file parsing if the file is in the previous working directory and provided without an explicit path. Also it makes general sense to parse the configuration file before daemonizing.
This commit is contained in:
22
repmgrd.c
22
repmgrd.c
@@ -218,6 +218,17 @@ main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the configuration file: repmgr.conf
|
||||
*/
|
||||
parse_config(config_file, &local_options);
|
||||
if (local_options.node == -1)
|
||||
{
|
||||
log_err(_("Node information is missing. "
|
||||
"Check the configuration file, or provide one if you have not done so.\n"));
|
||||
terminate(ERR_BAD_CONFIG);
|
||||
}
|
||||
|
||||
if (daemonize)
|
||||
{
|
||||
do_daemonize();
|
||||
@@ -232,17 +243,6 @@ main(int argc, char **argv)
|
||||
setup_event_handlers();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Read the configuration file: repmgr.conf
|
||||
*/
|
||||
parse_config(config_file, &local_options);
|
||||
if (local_options.node == -1)
|
||||
{
|
||||
log_err(_("Node information is missing. "
|
||||
"Check the configuration file, or provide one if you have not done so.\n"));
|
||||
terminate(ERR_BAD_CONFIG);
|
||||
}
|
||||
|
||||
fd = freopen("/dev/null", "r", stdin);
|
||||
if (fd == NULL)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user