aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/bootstrap/bootstrap.c2
-rw-r--r--src/backend/postmaster/postmaster.c4
-rw-r--r--src/bin/pg_dump/pg_dump.c16
-rw-r--r--src/bin/pg_dump/pg_dumpall.c12
-rw-r--r--src/bin/pg_dump/pg_restore.c4
-rw-r--r--src/bin/psql/startup.c14
-rw-r--r--src/bin/scripts/clusterdb.c12
-rw-r--r--src/bin/scripts/createdb.c22
-rw-r--r--src/bin/scripts/createlang.c8
-rw-r--r--src/bin/scripts/createuser.c8
-rw-r--r--src/bin/scripts/dropdb.c8
-rw-r--r--src/bin/scripts/droplang.c8
-rw-r--r--src/bin/scripts/dropuser.c6
-rw-r--r--src/bin/scripts/reindexdb.c14
-rw-r--r--src/bin/scripts/vacuumdb.c12
-rw-r--r--src/interfaces/ecpg/preproc/ecpg.c2
-rw-r--r--src/timezone/zic.c10
17 files changed, 81 insertions, 81 deletions
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index 34ddebbc0b9..11086e2964b 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -241,7 +241,7 @@ AuxiliaryProcessMain(int argc, char *argv[])
SetConfigOption("shared_buffers", optarg, PGC_POSTMASTER, PGC_S_ARGV);
break;
case 'D':
- userDoption = optarg;
+ userDoption = strdup(optarg);
break;
case 'd':
{
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index e73caa8b294..dfe40492d27 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -570,11 +570,11 @@ PostmasterMain(int argc, char *argv[])
break;
case 'C':
- output_config_variable = optarg;
+ output_config_variable = strdup(optarg);
break;
case 'D':
- userDoption = optarg;
+ userDoption = strdup(optarg);
break;
case 'd':
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 9920d967241..dd2019a1fb7 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -409,19 +409,19 @@ main(int argc, char **argv)
break;
case 'E': /* Dump encoding */
- dumpencoding = optarg;
+ dumpencoding = pg_strdup(optarg);
break;
case 'f':
- filename = optarg;
+ filename = pg_strdup(optarg);
break;
case 'F':
- format = optarg;
+ format = pg_strdup(optarg);
break;
case 'h': /* server host */
- pghost = optarg;
+ pghost = pg_strdup(optarg);
break;
case 'i':
@@ -446,7 +446,7 @@ main(int argc, char **argv)
break;
case 'p': /* server port */
- pgport = optarg;
+ pgport = pg_strdup(optarg);
break;
case 'R':
@@ -471,7 +471,7 @@ main(int argc, char **argv)
break;
case 'U':
- username = optarg;
+ username = pg_strdup(optarg);
break;
case 'v': /* verbose */
@@ -499,11 +499,11 @@ main(int argc, char **argv)
break;
case 2: /* lock-wait-timeout */
- lockWaitTimeout = optarg;
+ lockWaitTimeout = pg_strdup(optarg);
break;
case 3: /* SET ROLE */
- use_role = optarg;
+ use_role = pg_strdup(optarg);
break;
case 4: /* exclude table(s) data */
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 10ce2223df4..ca95bad1cc0 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -200,7 +200,7 @@ main(int argc, char *argv[])
break;
case 'f':
- filename = optarg;
+ filename = pg_strdup(optarg);
appendPQExpBuffer(pgdumpopts, " -f ");
doShellQuoting(pgdumpopts, filename);
break;
@@ -210,7 +210,7 @@ main(int argc, char *argv[])
break;
case 'h':
- pghost = optarg;
+ pghost = pg_strdup(optarg);
appendPQExpBuffer(pgdumpopts, " -h ");
doShellQuoting(pgdumpopts, pghost);
break;
@@ -220,7 +220,7 @@ main(int argc, char *argv[])
break;
case 'l':
- pgdb = optarg;
+ pgdb = pg_strdup(optarg);
break;
case 'o':
@@ -232,7 +232,7 @@ main(int argc, char *argv[])
break;
case 'p':
- pgport = optarg;
+ pgport = pg_strdup(optarg);
appendPQExpBuffer(pgdumpopts, " -p ");
doShellQuoting(pgdumpopts, pgport);
break;
@@ -255,7 +255,7 @@ main(int argc, char *argv[])
break;
case 'U':
- pguser = optarg;
+ pguser = pg_strdup(optarg);
appendPQExpBuffer(pgdumpopts, " -U ");
doShellQuoting(pgdumpopts, pguser);
break;
@@ -289,7 +289,7 @@ main(int argc, char *argv[])
break;
case 3:
- use_role = optarg;
+ use_role = pg_strdup(optarg);
appendPQExpBuffer(pgdumpopts, " --role ");
doShellQuoting(pgdumpopts, use_role);
break;
diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c
index f6c835be0d1..49d799b9530 100644
--- a/src/bin/pg_dump/pg_restore.c
+++ b/src/bin/pg_dump/pg_restore.c
@@ -238,7 +238,7 @@ main(int argc, char **argv)
break;
case 'U':
- opts->username = optarg;
+ opts->username = pg_strdup(optarg);
break;
case 'v': /* verbose */
@@ -270,7 +270,7 @@ main(int argc, char **argv)
break;
case 2: /* SET ROLE */
- opts->use_role = optarg;
+ opts->use_role = pg_strdup(optarg);
break;
case 3: /* section */
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index 3fb12c94522..1fcc47fad35 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -411,7 +411,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
pset.popt.topt.format = PRINT_UNALIGNED;
break;
case 'c':
- options->action_string = optarg;
+ options->action_string = pg_strdup(optarg);
if (optarg[0] == '\\')
{
options->action = ACT_SINGLE_SLASH;
@@ -421,7 +421,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
options->action = ACT_SINGLE_QUERY;
break;
case 'd':
- options->dbname = optarg;
+ options->dbname = pg_strdup(optarg);
break;
case 'e':
SetVariable(pset.vars, "ECHO", "queries");
@@ -431,14 +431,14 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
break;
case 'f':
options->action = ACT_FILE;
- options->action_string = optarg;
+ options->action_string = pg_strdup(optarg);
break;
case 'F':
pset.popt.topt.fieldSep.separator = pg_strdup(optarg);
pset.popt.topt.fieldSep.separator_zero = false;
break;
case 'h':
- options->host = optarg;
+ options->host = pg_strdup(optarg);
break;
case 'H':
pset.popt.topt.format = PRINT_HTML;
@@ -447,7 +447,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
options->action = ACT_LIST_DB;
break;
case 'L':
- options->logfilename = optarg;
+ options->logfilename = pg_strdup(optarg);
break;
case 'n':
options->no_readline = true;
@@ -456,7 +456,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
setQFout(optarg);
break;
case 'p':
- options->port = optarg;
+ options->port = pg_strdup(optarg);
break;
case 'P':
{
@@ -503,7 +503,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
pset.popt.topt.tableAttr = pg_strdup(optarg);
break;
case 'U':
- options->username = optarg;
+ options->username = pg_strdup(optarg);
break;
case 'v':
{
diff --git a/src/bin/scripts/clusterdb.c b/src/bin/scripts/clusterdb.c
index b8ac6759b48..261b438edad 100644
--- a/src/bin/scripts/clusterdb.c
+++ b/src/bin/scripts/clusterdb.c
@@ -71,13 +71,13 @@ main(int argc, char *argv[])
switch (c)
{
case 'h':
- host = optarg;
+ host = pg_strdup(optarg);
break;
case 'p':
- port = optarg;
+ port = pg_strdup(optarg);
break;
case 'U':
- username = optarg;
+ username = pg_strdup(optarg);
break;
case 'w':
prompt_password = TRI_NO;
@@ -92,19 +92,19 @@ main(int argc, char *argv[])
quiet = true;
break;
case 'd':
- dbname = optarg;
+ dbname = pg_strdup(optarg);
break;
case 'a':
alldb = true;
break;
case 't':
- table = optarg;
+ table = pg_strdup(optarg);
break;
case 'v':
verbose = true;
break;
case 2:
- maintenance_db = optarg;
+ maintenance_db = pg_strdup(optarg);
break;
default:
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
diff --git a/src/bin/scripts/createdb.c b/src/bin/scripts/createdb.c
index 91b1a24fd32..4df70cbfc6a 100644
--- a/src/bin/scripts/createdb.c
+++ b/src/bin/scripts/createdb.c
@@ -74,13 +74,13 @@ main(int argc, char *argv[])
switch (c)
{
case 'h':
- host = optarg;
+ host = pg_strdup(optarg);
break;
case 'p':
- port = optarg;
+ port = pg_strdup(optarg);
break;
case 'U':
- username = optarg;
+ username = pg_strdup(optarg);
break;
case 'w':
prompt_password = TRI_NO;
@@ -92,28 +92,28 @@ main(int argc, char *argv[])
echo = true;
break;
case 'O':
- owner = optarg;
+ owner = pg_strdup(optarg);
break;
case 'D':
- tablespace = optarg;
+ tablespace = pg_strdup(optarg);
break;
case 'T':
- template = optarg;
+ template = pg_strdup(optarg);
break;
case 'E':
- encoding = optarg;
+ encoding = pg_strdup(optarg);
break;
case 1:
- lc_collate = optarg;
+ lc_collate = pg_strdup(optarg);
break;
case 2:
- lc_ctype = optarg;
+ lc_ctype = pg_strdup(optarg);
break;
case 'l':
- locale = optarg;
+ locale = pg_strdup(optarg);
break;
case 3:
- maintenance_db = optarg;
+ maintenance_db = pg_strdup(optarg);
break;
default:
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
diff --git a/src/bin/scripts/createlang.c b/src/bin/scripts/createlang.c
index 60066af377f..b85cf04e7a1 100644
--- a/src/bin/scripts/createlang.c
+++ b/src/bin/scripts/createlang.c
@@ -65,13 +65,13 @@ main(int argc, char *argv[])
listlangs = true;
break;
case 'h':
- host = optarg;
+ host = pg_strdup(optarg);
break;
case 'p':
- port = optarg;
+ port = pg_strdup(optarg);
break;
case 'U':
- username = optarg;
+ username = pg_strdup(optarg);
break;
case 'w':
prompt_password = TRI_NO;
@@ -80,7 +80,7 @@ main(int argc, char *argv[])
prompt_password = TRI_YES;
break;
case 'd':
- dbname = optarg;
+ dbname = pg_strdup(optarg);
break;
case 'e':
echo = true;
diff --git a/src/bin/scripts/createuser.c b/src/bin/scripts/createuser.c
index db3b5d04d8a..d35121b8aa5 100644
--- a/src/bin/scripts/createuser.c
+++ b/src/bin/scripts/createuser.c
@@ -89,13 +89,13 @@ main(int argc, char *argv[])
switch (c)
{
case 'h':
- host = optarg;
+ host = pg_strdup(optarg);
break;
case 'p':
- port = optarg;
+ port = pg_strdup(optarg);
break;
case 'U':
- username = optarg;
+ username = pg_strdup(optarg);
break;
case 'w':
prompt_password = TRI_NO;
@@ -139,7 +139,7 @@ main(int argc, char *argv[])
login = TRI_NO;
break;
case 'c':
- conn_limit = optarg;
+ conn_limit = pg_strdup(optarg);
break;
case 'P':
pwprompt = true;
diff --git a/src/bin/scripts/dropdb.c b/src/bin/scripts/dropdb.c
index 583655de6ae..5f978ccb838 100644
--- a/src/bin/scripts/dropdb.c
+++ b/src/bin/scripts/dropdb.c
@@ -64,13 +64,13 @@ main(int argc, char *argv[])
switch (c)
{
case 'h':
- host = optarg;
+ host = pg_strdup(optarg);
break;
case 'p':
- port = optarg;
+ port = pg_strdup(optarg);
break;
case 'U':
- username = optarg;
+ username = pg_strdup(optarg);
break;
case 'w':
prompt_password = TRI_NO;
@@ -88,7 +88,7 @@ main(int argc, char *argv[])
/* this covers the long options */
break;
case 2:
- maintenance_db = optarg;
+ maintenance_db = pg_strdup(optarg);
break;
default:
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
diff --git a/src/bin/scripts/droplang.c b/src/bin/scripts/droplang.c
index 4772dc514e3..b9f42bbccd3 100644
--- a/src/bin/scripts/droplang.c
+++ b/src/bin/scripts/droplang.c
@@ -64,13 +64,13 @@ main(int argc, char *argv[])
listlangs = true;
break;
case 'h':
- host = optarg;
+ host = pg_strdup(optarg);
break;
case 'p':
- port = optarg;
+ port = pg_strdup(optarg);
break;
case 'U':
- username = optarg;
+ username = pg_strdup(optarg);
break;
case 'w':
prompt_password = TRI_NO;
@@ -79,7 +79,7 @@ main(int argc, char *argv[])
prompt_password = TRI_YES;
break;
case 'd':
- dbname = optarg;
+ dbname = pg_strdup(optarg);
break;
case 'e':
echo = true;
diff --git a/src/bin/scripts/dropuser.c b/src/bin/scripts/dropuser.c
index d0bf6ff4978..7c101014c16 100644
--- a/src/bin/scripts/dropuser.c
+++ b/src/bin/scripts/dropuser.c
@@ -62,13 +62,13 @@ main(int argc, char *argv[])
switch (c)
{
case 'h':
- host = optarg;
+ host = pg_strdup(optarg);
break;
case 'p':
- port = optarg;
+ port = pg_strdup(optarg);
break;
case 'U':
- username = optarg;
+ username = pg_strdup(optarg);
break;
case 'w':
prompt_password = TRI_NO;
diff --git a/src/bin/scripts/reindexdb.c b/src/bin/scripts/reindexdb.c
index d1e27bdb5f7..f61dadaf55b 100644
--- a/src/bin/scripts/reindexdb.c
+++ b/src/bin/scripts/reindexdb.c
@@ -78,13 +78,13 @@ main(int argc, char *argv[])
switch (c)
{
case 'h':
- host = optarg;
+ host = pg_strdup(optarg);
break;
case 'p':
- port = optarg;
+ port = pg_strdup(optarg);
break;
case 'U':
- username = optarg;
+ username = pg_strdup(optarg);
break;
case 'w':
prompt_password = TRI_NO;
@@ -99,7 +99,7 @@ main(int argc, char *argv[])
quiet = true;
break;
case 'd':
- dbname = optarg;
+ dbname = pg_strdup(optarg);
break;
case 'a':
alldb = true;
@@ -108,13 +108,13 @@ main(int argc, char *argv[])
syscatalog = true;
break;
case 't':
- table = optarg;
+ table = pg_strdup(optarg);
break;
case 'i':
- index = optarg;
+ index = pg_strdup(optarg);
break;
case 2:
- maintenance_db = optarg;
+ maintenance_db = pg_strdup(optarg);
break;
default:
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c
index 0ac6ab4ed59..eb28ad4cc0f 100644
--- a/src/bin/scripts/vacuumdb.c
+++ b/src/bin/scripts/vacuumdb.c
@@ -82,13 +82,13 @@ main(int argc, char *argv[])
switch (c)
{
case 'h':
- host = optarg;
+ host = pg_strdup(optarg);
break;
case 'p':
- port = optarg;
+ port = pg_strdup(optarg);
break;
case 'U':
- username = optarg;
+ username = pg_strdup(optarg);
break;
case 'w':
prompt_password = TRI_NO;
@@ -103,7 +103,7 @@ main(int argc, char *argv[])
quiet = true;
break;
case 'd':
- dbname = optarg;
+ dbname = pg_strdup(optarg);
break;
case 'z':
and_analyze = true;
@@ -118,7 +118,7 @@ main(int argc, char *argv[])
alldb = true;
break;
case 't':
- table = optarg;
+ table = pg_strdup(optarg);
break;
case 'f':
full = true;
@@ -127,7 +127,7 @@ main(int argc, char *argv[])
verbose = true;
break;
case 2:
- maintenance_db = optarg;
+ maintenance_db = pg_strdup(optarg);
break;
default:
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c
index 7e7bae30a0b..1b775a13e8f 100644
--- a/src/interfaces/ecpg/preproc/ecpg.c
+++ b/src/interfaces/ecpg/preproc/ecpg.c
@@ -171,7 +171,7 @@ main(int argc, char *const argv[])
regression_mode = true;
break;
case 'o':
- output_filename = optarg;
+ output_filename = strdup(optarg);
if (strcmp(output_filename, "-") == 0)
yyout = stdout;
else
diff --git a/src/timezone/zic.c b/src/timezone/zic.c
index 8a95d6ac3f7..0aa90ebfca1 100644
--- a/src/timezone/zic.c
+++ b/src/timezone/zic.c
@@ -505,7 +505,7 @@ main(int argc, char *argv[])
usage(stderr, EXIT_FAILURE);
case 'd':
if (directory == NULL)
- directory = optarg;
+ directory = strdup(optarg);
else
{
(void) fprintf(stderr,
@@ -516,7 +516,7 @@ main(int argc, char *argv[])
break;
case 'l':
if (lcltime == NULL)
- lcltime = optarg;
+ lcltime = strdup(optarg);
else
{
(void) fprintf(stderr,
@@ -527,7 +527,7 @@ main(int argc, char *argv[])
break;
case 'p':
if (psxrules == NULL)
- psxrules = optarg;
+ psxrules = strdup(optarg);
else
{
(void) fprintf(stderr,
@@ -538,7 +538,7 @@ main(int argc, char *argv[])
break;
case 'y':
if (yitcommand == NULL)
- yitcommand = optarg;
+ yitcommand = strdup(optarg);
else
{
(void) fprintf(stderr,
@@ -549,7 +549,7 @@ main(int argc, char *argv[])
break;
case 'L':
if (leapsec == NULL)
- leapsec = optarg;
+ leapsec = strdup(optarg);
else
{
(void) fprintf(stderr,