diff --git a/config.c b/config.c index 4af25c24..f6b47954 100644 --- a/config.c +++ b/config.c @@ -240,6 +240,8 @@ parse_config(t_configuration_options *options) options->witness_repl_nodes_sync_interval_secs = 30; memset(options->event_notification_command, 0, sizeof(options->event_notification_command)); + options->event_notifications.head = NULL; + options->event_notifications.tail = NULL; options->tablespace_mapping.head = NULL; options->tablespace_mapping.tail = NULL; diff --git a/config.h b/config.h index 3449ad3c..bc6b92bf 100644 --- a/config.h +++ b/config.h @@ -83,7 +83,11 @@ typedef struct TablespaceList tablespace_mapping; } t_configuration_options; -#define T_CONFIGURATION_OPTIONS_INITIALIZER { "", -1, NO_UPSTREAM_NODE, "", MANUAL_FAILOVER, -1, "", "", "", "", "", "", "", -1, -1, -1, "", "", "", "", "", 0, 0, 0, 0, "", { NULL, NULL }, {NULL, NULL} } +/* + * The following will initialize the structure with a minimal set of options; + * actual defaults are set in parse_config() before parsing the configuration file + */ +#define T_CONFIGURATION_OPTIONS_INITIALIZER { "", -1, NO_UPSTREAM_NODE, "", MANUAL_FAILOVER, -1, "", "", "", "", "", "", "", -1, -1, -1, "", "", "", "", "", 0, 0, 0, 0, "", { NULL, NULL }, { NULL, NULL } } typedef struct ErrorListCell { diff --git a/repmgrd.c b/repmgrd.c index 5475d6c7..47a3ca15 100644 --- a/repmgrd.c +++ b/repmgrd.c @@ -44,11 +44,11 @@ /* Local info */ -t_configuration_options local_options; +t_configuration_options local_options = T_CONFIGURATION_OPTIONS_INITIALIZER; PGconn *my_local_conn = NULL; /* Master info */ -t_configuration_options master_options; +t_configuration_options master_options = T_CONFIGURATION_OPTIONS_INITIALIZER; PGconn *master_conn = NULL; @@ -61,8 +61,6 @@ bool failover_done = false; char *pid_file = NULL; -t_configuration_options config = T_CONFIGURATION_OPTIONS_INITIALIZER; - static void help(void); static void usage(void); static void check_cluster_configuration(PGconn *conn);