aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2004-12-06 01:09:20 +0000
committerNeil Conway <neilc@samurai.com>2004-12-06 01:09:20 +0000
commitb3f3092caddeff11dcd520d2038d44b4f1f2ac83 (patch)
treec14e4618e30f567f0068a720ec853d44788fec7b /src
parent29a26b25ba624fc7cf11558bd691a1429a0fb252 (diff)
downloadpostgresql-b3f3092caddeff11dcd520d2038d44b4f1f2ac83.tar.gz
postgresql-b3f3092caddeff11dcd520d2038d44b4f1f2ac83.zip
Fix off-by-1 bug in pg_ctl in -D handling, per report from pjmodos@parba.cz
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_ctl/pg_ctl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c
index 7a9e29874a8..162b435b800 100644
--- a/src/bin/pg_ctl/pg_ctl.c
+++ b/src/bin/pg_ctl/pg_ctl.c
@@ -4,7 +4,7 @@
*
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.48 2004/11/27 18:51:05 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.49 2004/12/06 01:09:20 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1289,10 +1289,10 @@ main(int argc, char **argv)
{
case 'D':
{
- char *pgdata_D = xmalloc(strlen(optarg));
+ char *pgdata_D;
char *env_var = xmalloc(strlen(optarg) + 8);
- strcpy(pgdata_D, optarg);
+ pgdata_D = xstrdup(optarg);
canonicalize_path(pgdata_D);
snprintf(env_var, strlen(optarg) + 8, "PGDATA=%s",
pgdata_D);