mirror of
https://github.com/postgres/postgres.git
synced 2025-06-23 14:01:44 +03:00
Put back canonicalization of PGDATA environment variable.
This commit is contained in:
@ -37,7 +37,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.410 2004/07/12 18:17:13 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.411 2004/07/12 19:14:56 momjian Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
*
|
*
|
||||||
@ -526,7 +526,10 @@ PostmasterMain(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (userPGDATA)
|
if (userPGDATA)
|
||||||
canonicalize_path(userPGDATA = strdup(userPGDATA));
|
{
|
||||||
|
userPGDATA = strdup(userPGDATA);
|
||||||
|
canonicalize_path(userPGDATA);
|
||||||
|
}
|
||||||
|
|
||||||
if (onlyConfigSpecified(userPGDATA))
|
if (onlyConfigSpecified(userPGDATA))
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.19 2004/07/12 18:17:13 momjian Exp $
|
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.20 2004/07/12 19:15:07 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1308,7 +1308,10 @@ main(int argc, char **argv)
|
|||||||
/* Note we put any -D switch into the env var above */
|
/* Note we put any -D switch into the env var above */
|
||||||
pg_data = getenv("PGDATA");
|
pg_data = getenv("PGDATA");
|
||||||
if (pg_data)
|
if (pg_data)
|
||||||
canonicalize_path(pg_data = xstrdup(pg_data));
|
{
|
||||||
|
/* XXX modifies environment var in-place ... ugly ... */
|
||||||
|
canonicalize_path(pg_data);
|
||||||
|
}
|
||||||
|
|
||||||
if (pg_data == NULL &&
|
if (pg_data == NULL &&
|
||||||
ctl_command != KILL_COMMAND && ctl_command != UNREGISTER_COMMAND)
|
ctl_command != KILL_COMMAND && ctl_command != UNREGISTER_COMMAND)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/port/path.c,v 1.23 2004/07/11 21:34:04 momjian Exp $
|
* $PostgreSQL: pgsql/src/port/path.c,v 1.24 2004/07/12 19:15:14 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -88,18 +88,17 @@ last_dir_separator(const char *filename)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* make all paths look like unix, with forward slashes
|
* Make all paths look like Unix
|
||||||
* also strip any trailing slash.
|
|
||||||
*
|
|
||||||
* The Windows command processor will accept suitably quoted paths
|
|
||||||
* with forward slashes, but barfs badly with mixed forward and back
|
|
||||||
* slashes. Removing the trailing slash on a path means we never get
|
|
||||||
* ugly double slashes. Don't remove a leading slash, though.
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
canonicalize_path(char *path)
|
canonicalize_path(char *path)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
/*
|
||||||
|
* The Windows command processor will accept suitably quoted paths
|
||||||
|
* with forward slashes, but barfs badly with mixed forward and back
|
||||||
|
* slashes.
|
||||||
|
*/
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
for (p = path; *p; p++)
|
for (p = path; *p; p++)
|
||||||
@ -107,8 +106,19 @@ canonicalize_path(char *path)
|
|||||||
if (*p == '\\')
|
if (*p == '\\')
|
||||||
*p = '/';
|
*p = '/';
|
||||||
}
|
}
|
||||||
|
/* In Win32, if you do:
|
||||||
|
* prog.exe "a b" "\c\d\"
|
||||||
|
* the system will pass \c\d" as argv[2].
|
||||||
|
*/
|
||||||
|
if (p > path && *(p-1) == '"')
|
||||||
|
*(p-1) = '/';
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Removing the trailing slash on a path means we never get
|
||||||
|
* ugly double slashes. Don't remove a leading slash, though.
|
||||||
|
* Also, Win32 can't stat() a directory with a trailing slash.
|
||||||
|
*/
|
||||||
trim_trailing_separator(path);
|
trim_trailing_separator(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user