mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 08:56:29 +00:00
Use maxlen_snprintf() in do_witness_create()
This commit is contained in:
10
repmgr.c
10
repmgr.c
@@ -3361,7 +3361,7 @@ do_witness_create(void)
|
|||||||
if (!runtime_options.superuser[0])
|
if (!runtime_options.superuser[0])
|
||||||
strncpy(runtime_options.superuser, "postgres", MAXLEN);
|
strncpy(runtime_options.superuser, "postgres", MAXLEN);
|
||||||
|
|
||||||
sprintf(script, "%s %s -D %s init -o \"%s-U %s\"",
|
maxlen_snprintf(script, "%s %s -D %s init -o \"%s-U %s\"",
|
||||||
make_pg_path("pg_ctl"),
|
make_pg_path("pg_ctl"),
|
||||||
options.pg_ctl_options, runtime_options.dest_dir,
|
options.pg_ctl_options, runtime_options.dest_dir,
|
||||||
runtime_options.initdb_no_pwprompt ? "" : "-W ",
|
runtime_options.initdb_no_pwprompt ? "" : "-W ",
|
||||||
@@ -3441,7 +3441,7 @@ do_witness_create(void)
|
|||||||
|
|
||||||
|
|
||||||
/* start new instance */
|
/* start new instance */
|
||||||
sprintf(script, "%s %s -w -D %s start",
|
maxlen_snprintf(script, "%s %s -w -D %s start",
|
||||||
make_pg_path("pg_ctl"),
|
make_pg_path("pg_ctl"),
|
||||||
options.pg_ctl_options, runtime_options.dest_dir);
|
options.pg_ctl_options, runtime_options.dest_dir);
|
||||||
log_info(_("starting witness server: %s\n"), script);
|
log_info(_("starting witness server: %s\n"), script);
|
||||||
@@ -3466,7 +3466,7 @@ do_witness_create(void)
|
|||||||
if (runtime_options.username[0] && runtime_options.localport[0] && strcmp(runtime_options.username,"postgres") != 0)
|
if (runtime_options.username[0] && runtime_options.localport[0] && strcmp(runtime_options.username,"postgres") != 0)
|
||||||
{
|
{
|
||||||
/* create required user; needs to be superuser to create untrusted language function in c */
|
/* create required user; needs to be superuser to create untrusted language function in c */
|
||||||
sprintf(script, "%s -p %s --superuser --login -U %s %s",
|
maxlen_snprintf(script, "%s -p %s --superuser --login -U %s %s",
|
||||||
make_pg_path("createuser"),
|
make_pg_path("createuser"),
|
||||||
runtime_options.localport, runtime_options.superuser, runtime_options.username);
|
runtime_options.localport, runtime_options.superuser, runtime_options.username);
|
||||||
log_info(_("creating user for witness db: %s.\n"), script);
|
log_info(_("creating user for witness db: %s.\n"), script);
|
||||||
@@ -3492,7 +3492,7 @@ do_witness_create(void)
|
|||||||
if (runtime_options.dbname[0] && strcmp(runtime_options.dbname,"postgres") != 0 && runtime_options.localport[0])
|
if (runtime_options.dbname[0] && strcmp(runtime_options.dbname,"postgres") != 0 && runtime_options.localport[0])
|
||||||
{
|
{
|
||||||
/* create required db */
|
/* create required db */
|
||||||
sprintf(script, "%s -p %s -U %s --owner=%s %s",
|
maxlen_snprintf(script, "%s -p %s -U %s --owner=%s %s",
|
||||||
make_pg_path("createdb"),
|
make_pg_path("createdb"),
|
||||||
runtime_options.localport, runtime_options.superuser, runtime_options.username, runtime_options.dbname);
|
runtime_options.localport, runtime_options.superuser, runtime_options.username, runtime_options.dbname);
|
||||||
log_info("creating database for witness db: %s.\n", script);
|
log_info("creating database for witness db: %s.\n", script);
|
||||||
@@ -3552,7 +3552,7 @@ do_witness_create(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* reload to adapt for changed pg_hba.conf */
|
/* reload to adapt for changed pg_hba.conf */
|
||||||
sprintf(script, "%s %s -w -D %s reload",
|
maxlen_snprintf(script, "%s %s -w -D %s reload",
|
||||||
make_pg_path("pg_ctl"),
|
make_pg_path("pg_ctl"),
|
||||||
options.pg_ctl_options, runtime_options.dest_dir);
|
options.pg_ctl_options, runtime_options.dest_dir);
|
||||||
log_info(_("reloading witness server configuration: %s"), script);
|
log_info(_("reloading witness server configuration: %s"), script);
|
||||||
|
|||||||
Reference in New Issue
Block a user