Commit 49ec6132 authored by Bruce Momjian's avatar Bruce Momjian

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

rather than just storing a pointer.
parent a29f7ed5
...@@ -299,7 +299,7 @@ main(int argc, char **argv) ...@@ -299,7 +299,7 @@ main(int argc, char **argv)
dryrun = true; dryrun = true;
break; break;
case 'x': case 'x':
additional_ext = optarg; /* Extension to remove from additional_ext = strdup(optarg); /* Extension to remove from
* xlogfile names */ * xlogfile names */
break; break;
default: default:
......
...@@ -643,7 +643,7 @@ main(int argc, char **argv) ...@@ -643,7 +643,7 @@ main(int argc, char **argv)
} }
break; break;
case 't': /* Trigger file */ case 't': /* Trigger file */
triggerPath = optarg; triggerPath = strdup(optarg);
break; break;
case 'w': /* Max wait time */ case 'w': /* Max wait time */
maxwaittime = atoi(optarg); maxwaittime = atoi(optarg);
......
...@@ -1995,7 +1995,7 @@ main(int argc, char **argv) ...@@ -1995,7 +1995,7 @@ main(int argc, char **argv)
is_init_mode++; is_init_mode++;
break; break;
case 'h': case 'h':
pghost = optarg; pghost = pg_strdup(optarg);
break; break;
case 'n': case 'n':
is_no_vacuum++; is_no_vacuum++;
...@@ -2004,7 +2004,7 @@ main(int argc, char **argv) ...@@ -2004,7 +2004,7 @@ main(int argc, char **argv)
do_vacuum_accounts++; do_vacuum_accounts++;
break; break;
case 'p': case 'p':
pgport = optarg; pgport = pg_strdup(optarg);
break; break;
case 'd': case 'd':
debug++; debug++;
...@@ -2090,14 +2090,14 @@ main(int argc, char **argv) ...@@ -2090,14 +2090,14 @@ main(int argc, char **argv)
} }
break; break;
case 'U': case 'U':
login = optarg; login = pg_strdup(optarg);
break; break;
case 'l': case 'l':
use_log = true; use_log = true;
break; break;
case 'f': case 'f':
ttype = 3; ttype = 3;
filename = optarg; filename = pg_strdup(optarg);
if (process_file(filename) == false || *sql_files[num_files - 1] == NULL) if (process_file(filename) == false || *sql_files[num_files - 1] == NULL)
exit(1); exit(1);
break; break;
...@@ -2143,10 +2143,10 @@ main(int argc, char **argv) ...@@ -2143,10 +2143,10 @@ main(int argc, char **argv)
/* This covers long options which take no argument. */ /* This covers long options which take no argument. */
break; break;
case 2: /* tablespace */ case 2: /* tablespace */
tablespace = optarg; tablespace = pg_strdup(optarg);
break; break;
case 3: /* index-tablespace */ case 3: /* index-tablespace */
index_tablespace = optarg; index_tablespace = pg_strdup(optarg);
break; break;
case 4: case 4:
sample_rate = atof(optarg); sample_rate = atof(optarg);
......
...@@ -241,7 +241,7 @@ AuxiliaryProcessMain(int argc, char *argv[]) ...@@ -241,7 +241,7 @@ AuxiliaryProcessMain(int argc, char *argv[])
SetConfigOption("shared_buffers", optarg, PGC_POSTMASTER, PGC_S_ARGV); SetConfigOption("shared_buffers", optarg, PGC_POSTMASTER, PGC_S_ARGV);
break; break;
case 'D': case 'D':
userDoption = optarg; userDoption = strdup(optarg);
break; break;
case 'd': case 'd':
{ {
......
...@@ -570,11 +570,11 @@ PostmasterMain(int argc, char *argv[]) ...@@ -570,11 +570,11 @@ PostmasterMain(int argc, char *argv[])
break; break;
case 'C': case 'C':
output_config_variable = optarg; output_config_variable = strdup(optarg);
break; break;
case 'D': case 'D':
userDoption = optarg; userDoption = strdup(optarg);
break; break;
case 'd': case 'd':
......
...@@ -409,19 +409,19 @@ main(int argc, char **argv) ...@@ -409,19 +409,19 @@ main(int argc, char **argv)
break; break;
case 'E': /* Dump encoding */ case 'E': /* Dump encoding */
dumpencoding = optarg; dumpencoding = pg_strdup(optarg);
break; break;
case 'f': case 'f':
filename = optarg; filename = pg_strdup(optarg);
break; break;
case 'F': case 'F':
format = optarg; format = pg_strdup(optarg);
break; break;
case 'h': /* server host */ case 'h': /* server host */
pghost = optarg; pghost = pg_strdup(optarg);
break; break;
case 'i': case 'i':
...@@ -446,7 +446,7 @@ main(int argc, char **argv) ...@@ -446,7 +446,7 @@ main(int argc, char **argv)
break; break;
case 'p': /* server port */ case 'p': /* server port */
pgport = optarg; pgport = pg_strdup(optarg);
break; break;
case 'R': case 'R':
...@@ -471,7 +471,7 @@ main(int argc, char **argv) ...@@ -471,7 +471,7 @@ main(int argc, char **argv)
break; break;
case 'U': case 'U':
username = optarg; username = pg_strdup(optarg);
break; break;
case 'v': /* verbose */ case 'v': /* verbose */
...@@ -499,11 +499,11 @@ main(int argc, char **argv) ...@@ -499,11 +499,11 @@ main(int argc, char **argv)
break; break;
case 2: /* lock-wait-timeout */ case 2: /* lock-wait-timeout */
lockWaitTimeout = optarg; lockWaitTimeout = pg_strdup(optarg);
break; break;
case 3: /* SET ROLE */ case 3: /* SET ROLE */
use_role = optarg; use_role = pg_strdup(optarg);
break; break;
case 4: /* exclude table(s) data */ case 4: /* exclude table(s) data */
......
...@@ -200,7 +200,7 @@ main(int argc, char *argv[]) ...@@ -200,7 +200,7 @@ main(int argc, char *argv[])
break; break;
case 'f': case 'f':
filename = optarg; filename = pg_strdup(optarg);
appendPQExpBuffer(pgdumpopts, " -f "); appendPQExpBuffer(pgdumpopts, " -f ");
doShellQuoting(pgdumpopts, filename); doShellQuoting(pgdumpopts, filename);
break; break;
...@@ -210,7 +210,7 @@ main(int argc, char *argv[]) ...@@ -210,7 +210,7 @@ main(int argc, char *argv[])
break; break;
case 'h': case 'h':
pghost = optarg; pghost = pg_strdup(optarg);
appendPQExpBuffer(pgdumpopts, " -h "); appendPQExpBuffer(pgdumpopts, " -h ");
doShellQuoting(pgdumpopts, pghost); doShellQuoting(pgdumpopts, pghost);
break; break;
...@@ -220,7 +220,7 @@ main(int argc, char *argv[]) ...@@ -220,7 +220,7 @@ main(int argc, char *argv[])
break; break;
case 'l': case 'l':
pgdb = optarg; pgdb = pg_strdup(optarg);
break; break;
case 'o': case 'o':
...@@ -232,7 +232,7 @@ main(int argc, char *argv[]) ...@@ -232,7 +232,7 @@ main(int argc, char *argv[])
break; break;
case 'p': case 'p':
pgport = optarg; pgport = pg_strdup(optarg);
appendPQExpBuffer(pgdumpopts, " -p "); appendPQExpBuffer(pgdumpopts, " -p ");
doShellQuoting(pgdumpopts, pgport); doShellQuoting(pgdumpopts, pgport);
break; break;
...@@ -255,7 +255,7 @@ main(int argc, char *argv[]) ...@@ -255,7 +255,7 @@ main(int argc, char *argv[])
break; break;
case 'U': case 'U':
pguser = optarg; pguser = pg_strdup(optarg);
appendPQExpBuffer(pgdumpopts, " -U "); appendPQExpBuffer(pgdumpopts, " -U ");
doShellQuoting(pgdumpopts, pguser); doShellQuoting(pgdumpopts, pguser);
break; break;
...@@ -289,7 +289,7 @@ main(int argc, char *argv[]) ...@@ -289,7 +289,7 @@ main(int argc, char *argv[])
break; break;
case 3: case 3:
use_role = optarg; use_role = pg_strdup(optarg);
appendPQExpBuffer(pgdumpopts, " --role "); appendPQExpBuffer(pgdumpopts, " --role ");
doShellQuoting(pgdumpopts, use_role); doShellQuoting(pgdumpopts, use_role);
break; break;
......
...@@ -238,7 +238,7 @@ main(int argc, char **argv) ...@@ -238,7 +238,7 @@ main(int argc, char **argv)
break; break;
case 'U': case 'U':
opts->username = optarg; opts->username = pg_strdup(optarg);
break; break;
case 'v': /* verbose */ case 'v': /* verbose */
...@@ -270,7 +270,7 @@ main(int argc, char **argv) ...@@ -270,7 +270,7 @@ main(int argc, char **argv)
break; break;
case 2: /* SET ROLE */ case 2: /* SET ROLE */
opts->use_role = optarg; opts->use_role = pg_strdup(optarg);
break; break;
case 3: /* section */ case 3: /* section */
......
...@@ -411,7 +411,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options) ...@@ -411,7 +411,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
pset.popt.topt.format = PRINT_UNALIGNED; pset.popt.topt.format = PRINT_UNALIGNED;
break; break;
case 'c': case 'c':
options->action_string = optarg; options->action_string = pg_strdup(optarg);
if (optarg[0] == '\\') if (optarg[0] == '\\')
{ {
options->action = ACT_SINGLE_SLASH; options->action = ACT_SINGLE_SLASH;
...@@ -421,7 +421,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options) ...@@ -421,7 +421,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
options->action = ACT_SINGLE_QUERY; options->action = ACT_SINGLE_QUERY;
break; break;
case 'd': case 'd':
options->dbname = optarg; options->dbname = pg_strdup(optarg);
break; break;
case 'e': case 'e':
SetVariable(pset.vars, "ECHO", "queries"); SetVariable(pset.vars, "ECHO", "queries");
...@@ -431,14 +431,14 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options) ...@@ -431,14 +431,14 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
break; break;
case 'f': case 'f':
options->action = ACT_FILE; options->action = ACT_FILE;
options->action_string = optarg; options->action_string = pg_strdup(optarg);
break; break;
case 'F': case 'F':
pset.popt.topt.fieldSep.separator = pg_strdup(optarg); pset.popt.topt.fieldSep.separator = pg_strdup(optarg);
pset.popt.topt.fieldSep.separator_zero = false; pset.popt.topt.fieldSep.separator_zero = false;
break; break;
case 'h': case 'h':
options->host = optarg; options->host = pg_strdup(optarg);
break; break;
case 'H': case 'H':
pset.popt.topt.format = PRINT_HTML; pset.popt.topt.format = PRINT_HTML;
...@@ -447,7 +447,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options) ...@@ -447,7 +447,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
options->action = ACT_LIST_DB; options->action = ACT_LIST_DB;
break; break;
case 'L': case 'L':
options->logfilename = optarg; options->logfilename = pg_strdup(optarg);
break; break;
case 'n': case 'n':
options->no_readline = true; options->no_readline = true;
...@@ -456,7 +456,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options) ...@@ -456,7 +456,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
setQFout(optarg); setQFout(optarg);
break; break;
case 'p': case 'p':
options->port = optarg; options->port = pg_strdup(optarg);
break; break;
case 'P': case 'P':
{ {
...@@ -503,7 +503,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options) ...@@ -503,7 +503,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
pset.popt.topt.tableAttr = pg_strdup(optarg); pset.popt.topt.tableAttr = pg_strdup(optarg);
break; break;
case 'U': case 'U':
options->username = optarg; options->username = pg_strdup(optarg);
break; break;
case 'v': case 'v':
{ {
......
...@@ -71,13 +71,13 @@ main(int argc, char *argv[]) ...@@ -71,13 +71,13 @@ main(int argc, char *argv[])
switch (c) switch (c)
{ {
case 'h': case 'h':
host = optarg; host = pg_strdup(optarg);
break; break;
case 'p': case 'p':
port = optarg; port = pg_strdup(optarg);
break; break;
case 'U': case 'U':
username = optarg; username = pg_strdup(optarg);
break; break;
case 'w': case 'w':
prompt_password = TRI_NO; prompt_password = TRI_NO;
...@@ -92,19 +92,19 @@ main(int argc, char *argv[]) ...@@ -92,19 +92,19 @@ main(int argc, char *argv[])
quiet = true; quiet = true;
break; break;
case 'd': case 'd':
dbname = optarg; dbname = pg_strdup(optarg);
break; break;
case 'a': case 'a':
alldb = true; alldb = true;
break; break;
case 't': case 't':
table = optarg; table = pg_strdup(optarg);
break; break;
case 'v': case 'v':
verbose = true; verbose = true;
break; break;
case 2: case 2:
maintenance_db = optarg; maintenance_db = pg_strdup(optarg);
break; break;
default: default:
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname); fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
......
...@@ -74,13 +74,13 @@ main(int argc, char *argv[]) ...@@ -74,13 +74,13 @@ main(int argc, char *argv[])
switch (c) switch (c)
{ {
case 'h': case 'h':
host = optarg; host = pg_strdup(optarg);
break; break;
case 'p': case 'p':
port = optarg; port = pg_strdup(optarg);
break; break;
case 'U': case 'U':
username = optarg; username = pg_strdup(optarg);
break; break;
case 'w': case 'w':
prompt_password = TRI_NO; prompt_password = TRI_NO;
...@@ -92,28 +92,28 @@ main(int argc, char *argv[]) ...@@ -92,28 +92,28 @@ main(int argc, char *argv[])
echo = true; echo = true;
break; break;
case 'O': case 'O':
owner = optarg; owner = pg_strdup(optarg);
break; break;
case 'D': case 'D':
tablespace = optarg; tablespace = pg_strdup(optarg);
break; break;
case 'T': case 'T':
template = optarg; template = pg_strdup(optarg);
break; break;
case 'E': case 'E':
encoding = optarg; encoding = pg_strdup(optarg);
break; break;
case 1: case 1:
lc_collate = optarg; lc_collate = pg_strdup(optarg);
break; break;
case 2: case 2:
lc_ctype = optarg; lc_ctype = pg_strdup(optarg);
break; break;
case 'l': case 'l':
locale = optarg; locale = pg_strdup(optarg);
break; break;
case 3: case 3:
maintenance_db = optarg; maintenance_db = pg_strdup(optarg);
break; break;
default: default:
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname); fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
......
...@@ -65,13 +65,13 @@ main(int argc, char *argv[]) ...@@ -65,13 +65,13 @@ main(int argc, char *argv[])
listlangs = true; listlangs = true;
break; break;
case 'h': case 'h':
host = optarg; host = pg_strdup(optarg);
break; break;
case 'p': case 'p':
port = optarg; port = pg_strdup(optarg);
break; break;
case 'U': case 'U':
username = optarg; username = pg_strdup(optarg);
break; break;
case 'w': case 'w':
prompt_password = TRI_NO; prompt_password = TRI_NO;
...@@ -80,7 +80,7 @@ main(int argc, char *argv[]) ...@@ -80,7 +80,7 @@ main(int argc, char *argv[])
prompt_password = TRI_YES; prompt_password = TRI_YES;
break; break;
case 'd': case 'd':
dbname = optarg; dbname = pg_strdup(optarg);
break; break;
case 'e': case 'e':
echo = true; echo = true;
......
...@@ -89,13 +89,13 @@ main(int argc, char *argv[]) ...@@ -89,13 +89,13 @@ main(int argc, char *argv[])
switch (c) switch (c)
{ {
case 'h': case 'h':
host = optarg; host = pg_strdup(optarg);
break; break;
case 'p': case 'p':
port = optarg; port = pg_strdup(optarg);
break; break;
case 'U': case 'U':
username = optarg; username = pg_strdup(optarg);
break; break;
case 'w': case 'w':
prompt_password = TRI_NO; prompt_password = TRI_NO;
...@@ -139,7 +139,7 @@ main(int argc, char *argv[]) ...@@ -139,7 +139,7 @@ main(int argc, char *argv[])
login = TRI_NO; login = TRI_NO;
break; break;
case 'c': case 'c':
conn_limit = optarg; conn_limit = pg_strdup(optarg);
break; break;
case 'P': case 'P':
pwprompt = true; pwprompt = true;
......
...@@ -64,13 +64,13 @@ main(int argc, char *argv[]) ...@@ -64,13 +64,13 @@ main(int argc, char *argv[])
switch (c) switch (c)
{ {
case 'h': case 'h':
host = optarg; host = pg_strdup(optarg);
break; break;
case 'p': case 'p':
port = optarg; port = pg_strdup(optarg);
break; break;
case 'U': case 'U':
username = optarg; username = pg_strdup(optarg);
break; break;
case 'w': case 'w':
prompt_password = TRI_NO; prompt_password = TRI_NO;
...@@ -88,7 +88,7 @@ main(int argc, char *argv[]) ...@@ -88,7 +88,7 @@ main(int argc, char *argv[])
/* this covers the long options */ /* this covers the long options */
break; break;
case 2: case 2:
maintenance_db = optarg; maintenance_db = pg_strdup(optarg);
break; break;
default: default:
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname); fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
......
...@@ -64,13 +64,13 @@ main(int argc, char *argv[]) ...@@ -64,13 +64,13 @@ main(int argc, char *argv[])
listlangs = true; listlangs = true;
break; break;
case 'h': case 'h':
host = optarg; host = pg_strdup(optarg);
break; break;
case 'p': case 'p':
port = optarg; port = pg_strdup(optarg);
break; break;
case 'U': case 'U':
username = optarg; username = pg_strdup(optarg);
break; break;
case 'w': case 'w':
prompt_password = TRI_NO; prompt_password = TRI_NO;
...@@ -79,7 +79,7 @@ main(int argc, char *argv[]) ...@@ -79,7 +79,7 @@ main(int argc, char *argv[])
prompt_password = TRI_YES; prompt_password = TRI_YES;
break; break;
case 'd': case 'd':
dbname = optarg; dbname = pg_strdup(optarg);
break; break;
case 'e': case 'e':
echo = true; echo = true;
......
...@@ -62,13 +62,13 @@ main(int argc, char *argv[]) ...@@ -62,13 +62,13 @@ main(int argc, char *argv[])
switch (c) switch (c)
{ {
case 'h': case 'h':
host = optarg; host = pg_strdup(optarg);
break; break;
case 'p': case 'p':
port = optarg; port = pg_strdup(optarg);
break; break;
case 'U': case 'U':
username = optarg; username = pg_strdup(optarg);
break; break;
case 'w': case 'w':
prompt_password = TRI_NO; prompt_password = TRI_NO;
......
...@@ -78,13 +78,13 @@ main(int argc, char *argv[]) ...@@ -78,13 +78,13 @@ main(int argc, char *argv[])
switch (c) switch (c)
{ {
case 'h': case 'h':
host = optarg; host = pg_strdup(optarg);
break; break;
case 'p': case 'p':
port = optarg; port = pg_strdup(optarg);
break; break;
case 'U': case 'U':
username = optarg; username = pg_strdup(optarg);
break; break;
case 'w': case 'w':
prompt_password = TRI_NO; prompt_password = TRI_NO;
...@@ -99,7 +99,7 @@ main(int argc, char *argv[]) ...@@ -99,7 +99,7 @@ main(int argc, char *argv[])
quiet = true; quiet = true;
break; break;
case 'd': case 'd':
dbname = optarg; dbname = pg_strdup(optarg);
break; break;
case 'a': case 'a':
alldb = true; alldb = true;
...@@ -108,13 +108,13 @@ main(int argc, char *argv[]) ...@@ -108,13 +108,13 @@ main(int argc, char *argv[])
syscatalog = true; syscatalog = true;
break; break;
case 't': case 't':
table = optarg; table = pg_strdup(optarg);
break; break;
case 'i': case 'i':
index = optarg; index = pg_strdup(optarg);
break; break;
case 2: case 2:
maintenance_db = optarg; maintenance_db = pg_strdup(optarg);
break; break;
default: default:
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname); fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
......
...@@ -82,13 +82,13 @@ main(int argc, char *argv[]) ...@@ -82,13 +82,13 @@ main(int argc, char *argv[])
switch (c) switch (c)
{ {
case 'h': case 'h':
host = optarg; host = pg_strdup(optarg);
break; break;
case 'p': case 'p':
port = optarg; port = pg_strdup(optarg);
break; break;
case 'U': case 'U':
username = optarg; username = pg_strdup(optarg);
break; break;
case 'w': case 'w':
prompt_password = TRI_NO; prompt_password = TRI_NO;
...@@ -103,7 +103,7 @@ main(int argc, char *argv[]) ...@@ -103,7 +103,7 @@ main(int argc, char *argv[])
quiet = true; quiet = true;
break; break;
case 'd': case 'd':
dbname = optarg; dbname = pg_strdup(optarg);
break; break;
case 'z': case 'z':
and_analyze = true; and_analyze = true;
...@@ -118,7 +118,7 @@ main(int argc, char *argv[]) ...@@ -118,7 +118,7 @@ main(int argc, char *argv[])
alldb = true; alldb = true;
break; break;
case 't': case 't':
table = optarg; table = pg_strdup(optarg);
break; break;
case 'f': case 'f':
full = true; full = true;
...@@ -127,7 +127,7 @@ main(int argc, char *argv[]) ...@@ -127,7 +127,7 @@ main(int argc, char *argv[])
verbose = true; verbose = true;
break; break;
case 2: case 2:
maintenance_db = optarg; maintenance_db = pg_strdup(optarg);
break; break;
default: default:
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname); fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
......
...@@ -171,7 +171,7 @@ main(int argc, char *const argv[]) ...@@ -171,7 +171,7 @@ main(int argc, char *const argv[])
regression_mode = true; regression_mode = true;
break; break;
case 'o': case 'o':
output_filename = optarg; output_filename = strdup(optarg);
if (strcmp(output_filename, "-") == 0) if (strcmp(output_filename, "-") == 0)
yyout = stdout; yyout = stdout;
else else
......
...@@ -505,7 +505,7 @@ main(int argc, char *argv[]) ...@@ -505,7 +505,7 @@ main(int argc, char *argv[])
usage(stderr, EXIT_FAILURE); usage(stderr, EXIT_FAILURE);
case 'd': case 'd':
if (directory == NULL) if (directory == NULL)
directory = optarg; directory = strdup(optarg);
else else
{ {
(void) fprintf(stderr, (void) fprintf(stderr,
...@@ -516,7 +516,7 @@ main(int argc, char *argv[]) ...@@ -516,7 +516,7 @@ main(int argc, char *argv[])
break; break;
case 'l': case 'l':
if (lcltime == NULL) if (lcltime == NULL)
lcltime = optarg; lcltime = strdup(optarg);
else else
{ {
(void) fprintf(stderr, (void) fprintf(stderr,
...@@ -527,7 +527,7 @@ main(int argc, char *argv[]) ...@@ -527,7 +527,7 @@ main(int argc, char *argv[])
break; break;
case 'p': case 'p':
if (psxrules == NULL) if (psxrules == NULL)
psxrules = optarg; psxrules = strdup(optarg);
else else
{ {
(void) fprintf(stderr, (void) fprintf(stderr,
...@@ -538,7 +538,7 @@ main(int argc, char *argv[]) ...@@ -538,7 +538,7 @@ main(int argc, char *argv[])
break; break;
case 'y': case 'y':
if (yitcommand == NULL) if (yitcommand == NULL)
yitcommand = optarg; yitcommand = strdup(optarg);
else else
{ {
(void) fprintf(stderr, (void) fprintf(stderr,
...@@ -549,7 +549,7 @@ main(int argc, char *argv[]) ...@@ -549,7 +549,7 @@ main(int argc, char *argv[])
break; break;
case 'L': case 'L':
if (leapsec == NULL) if (leapsec == NULL)
leapsec = optarg; leapsec = strdup(optarg);
else else
{ {
(void) fprintf(stderr, (void) fprintf(stderr,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment