diff options
author | Bruce Momjian <bruce@momjian.us> | 2012-10-12 13:35:40 -0400 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2012-10-12 13:35:43 -0400 |
commit | 49ec613201b2e9debdf9e9ad9a2ad7c6c8083729 (patch) | |
tree | 16626d363ecc7b021b2fda82bb27b811e2335c09 /src/bin/scripts/createdb.c | |
parent | a29f7ed5544ef583747c0dcc3fc2afac1fb191ef (diff) |
In our source code, make a copy of getopt's 'optarg' string arguments,
rather than just storing a pointer.
Diffstat (limited to 'src/bin/scripts/createdb.c')
-rw-r--r-- | src/bin/scripts/createdb.c | 22 |
1 files changed, 11 insertions, 11 deletions
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); |