1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-25 13:17:41 +03:00

In our source code, make a copy of getopt's 'optarg' string arguments,

rather than just storing a pointer.
This commit is contained in:
Bruce Momjian
2012-10-12 13:35:40 -04:00
parent a29f7ed554
commit 49ec613201
20 changed files with 89 additions and 89 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);