Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit76e7e2e

Browse files
committed
Use strdup in pg_ctl for canonicalize_path on environment variable.
Simplify postmaster call too.
1 parenta0db74a commit76e7e2e

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.409 2004/07/11 23:49:45 momjian Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.410 2004/07/12 18:17:13 momjian Exp $
4141
*
4242
* NOTES
4343
*
@@ -526,10 +526,7 @@ PostmasterMain(int argc, char *argv[])
526526
}
527527

528528
if (userPGDATA)
529-
{
530-
userPGDATA=strdup(userPGDATA);
531-
canonicalize_path(userPGDATA);
532-
}
529+
canonicalize_path(userPGDATA=strdup(userPGDATA));
533530

534531
if (onlyConfigSpecified(userPGDATA))
535532
{

‎src/bin/pg_ctl/pg_ctl.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.18 2004/06/25 08:49:28 dennis Exp $
7+
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.19 2004/07/12 18:17:13 momjian Exp $
88
*
99
*-------------------------------------------------------------------------
1010
*/
@@ -1308,10 +1308,7 @@ main(int argc, char **argv)
13081308
/* Note we put any -D switch into the env var above */
13091309
pg_data=getenv("PGDATA");
13101310
if (pg_data)
1311-
{
1312-
/* XXX modifies environment var in-place ... ugly ... */
1313-
canonicalize_path(pg_data);
1314-
}
1311+
canonicalize_path(pg_data=xstrdup(pg_data));
13151312

13161313
if (pg_data==NULL&&
13171314
ctl_command!=KILL_COMMAND&&ctl_command!=UNREGISTER_COMMAND)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp