Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
3fe70420
Commit
3fe70420
authored
Oct 27, 2004
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Canonicalize Win32 path coming in from pg_ctl -D, idea from Magnus.
parent
118bd918
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
15 deletions
+24
-15
src/bin/pg_ctl/pg_ctl.c
src/bin/pg_ctl/pg_ctl.c
+13
-9
src/port/path.c
src/port/path.c
+11
-6
No files found.
src/bin/pg_ctl/pg_ctl.c
View file @
3fe70420
...
...
@@ -4,7 +4,7 @@
*
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.4
2 2004/10/22 00:24:18 tgl
Exp $
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.4
3 2004/10/27 17:17:07 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1279,19 +1279,23 @@ main(int argc, char **argv)
{
case
'D'
:
{
int
len
=
strlen
(
optarg
);
char
*
env_var
;
char
*
pgdata_D
=
xmalloc
(
strlen
(
optarg
)
);
char
*
env_var
=
xmalloc
(
strlen
(
optarg
)
+
8
)
;
env_var
=
xmalloc
(
len
+
8
);
snprintf
(
env_var
,
len
+
8
,
"PGDATA=%s"
,
optarg
);
strcpy
(
pgdata_D
,
optarg
);
canonicalize_path
(
pgdata_D
);
snprintf
(
env_var
,
strlen
(
pgdata_D
)
+
8
,
"PGDATA=%s"
,
pgdata_D
);
putenv
(
env_var
);
/*
* Show -D for easier postmaster 'ps'
* identification
* We could pass PGDATA just in an environment
* variable but we do -D too for clearer
* postmaster 'ps' display
*/
pgdata_opt
=
xmalloc
(
len
+
7
);
snprintf
(
pgdata_opt
,
len
+
7
,
"-D
\"
%s
\"
"
,
optarg
);
pgdata_opt
=
xmalloc
(
strlen
(
pgdata_D
)
+
7
);
snprintf
(
pgdata_opt
,
strlen
(
pgdata_D
)
+
7
,
"-D
\"
%s
\"
"
,
pgdata_D
);
break
;
}
case
'l'
:
...
...
src/port/path.c
View file @
3fe70420
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/port/path.c,v 1.3
7 2004/10/24 22:08:19 tgl
Exp $
* $PostgreSQL: pgsql/src/port/path.c,v 1.3
8 2004/10/27 17:17:09 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -115,7 +115,12 @@ make_native_path(char *filename)
/*
* Make all paths look like Unix
* Clean up path by:
* o make Win32 path use Unix slashes
* o remove trailling quote on Win32
* o remove trailling slash
* o remove trailing '.'
* o process trailing '..' ourselves
*/
void
canonicalize_path
(
char
*
path
)
...
...
@@ -145,13 +150,13 @@ canonicalize_path(char *path)
/*
* Removing the trailing slash on a path means we never get ugly
* double
slashes. Also, Win32 can't stat() a directory with a
* trailing slash. Don't remove a leading slash, though.
* double
trailing slashes. Also, Win32 can't stat() a directory
*
with a
trailing slash. Don't remove a leading slash, though.
*/
trim_trailing_separator
(
path
);
/*
* Remove any trailing uses of "."
or "..", too.
* Remove any trailing uses of "."
and process ".." ourselves
*/
for
(;;)
{
...
...
@@ -165,7 +170,7 @@ canonicalize_path(char *path)
else
if
(
len
>=
3
&&
strcmp
(
path
+
len
-
3
,
"/.."
)
==
0
)
{
trim_directory
(
path
);
trim_directory
(
path
);
trim_directory
(
path
);
/* remove directory above */
trim_trailing_separator
(
path
);
}
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment