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
10a3d19a
Commit
10a3d19a
authored
Jun 10, 2004
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle multiple double-quoted strings using Win32's system() call.
Document limitations.
parent
93db6f6a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
17 deletions
+32
-17
src/bin/initdb/initdb.c
src/bin/initdb/initdb.c
+9
-9
src/bin/pg_ctl/pg_ctl.c
src/bin/pg_ctl/pg_ctl.c
+6
-5
src/bin/pg_dump/pg_dumpall.c
src/bin/pg_dump/pg_dumpall.c
+4
-2
src/include/port.h
src/include/port.h
+13
-1
No files found.
src/bin/initdb/initdb.c
View file @
10a3d19a
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
* Portions taken from FreeBSD.
*
*
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.3
5 2004/06/03 00:07:3
6 momjian Exp $
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.3
6 2004/06/10 16:35:1
6 momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -812,12 +812,12 @@ test_connections(void)
...
@@ -812,12 +812,12 @@ test_connections(void)
for
(
i
=
0
;
i
<
len
;
i
++
)
for
(
i
=
0
;
i
<
len
;
i
++
)
{
{
snprintf
(
cmd
,
sizeof
(
cmd
),
snprintf
(
cmd
,
sizeof
(
cmd
),
"
\"
%s
\"
-boot -x0 %s "
"
%s
\"
%s
\"
-boot -x0 %s "
"-c shared_buffers=%d -c max_connections=%d template1 "
"-c shared_buffers=%d -c max_connections=%d template1 "
"<
%s >%s 2>&1
"
,
"<
\"
%s
\"
>
\"
%s
\"
2>&1%s
"
,
backend_exec
,
boot_options
,
SYSTEMQUOTE
,
backend_exec
,
boot_options
,
conns
[
i
]
*
5
,
conns
[
i
],
conns
[
i
]
*
5
,
conns
[
i
],
DEVNULL
,
DEVNULL
);
DEVNULL
,
DEVNULL
,
SYSTEMQUOTE
);
status
=
system
(
cmd
);
status
=
system
(
cmd
);
if
(
status
==
0
)
if
(
status
==
0
)
break
;
break
;
...
@@ -848,12 +848,12 @@ test_buffers(void)
...
@@ -848,12 +848,12 @@ test_buffers(void)
for
(
i
=
0
;
i
<
len
;
i
++
)
for
(
i
=
0
;
i
<
len
;
i
++
)
{
{
snprintf
(
cmd
,
sizeof
(
cmd
),
snprintf
(
cmd
,
sizeof
(
cmd
),
"
\"
%s
\"
-boot -x0 %s "
"
%s
\"
%s
\"
-boot -x0 %s "
"-c shared_buffers=%d -c max_connections=%d template1 "
"-c shared_buffers=%d -c max_connections=%d template1 "
"<
%s >%s 2>&1
"
,
"<
\"
%s
\"
>
\"
%s
\"
2>&1%s
"
,
backend_exec
,
boot_options
,
SYSTEMQUOTE
,
backend_exec
,
boot_options
,
bufs
[
i
],
n_connections
,
bufs
[
i
],
n_connections
,
DEVNULL
,
DEVNULL
);
DEVNULL
,
DEVNULL
,
SYSTEMQUOTE
);
status
=
system
(
cmd
);
status
=
system
(
cmd
);
if
(
status
==
0
)
if
(
status
==
0
)
break
;
break
;
...
...
src/bin/pg_ctl/pg_ctl.c
View file @
10a3d19a
...
@@ -4,7 +4,7 @@
...
@@ -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.
8 2004/06/09 17:36:0
7 momjian Exp $
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.
9 2004/06/10 16:35:1
7 momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -224,11 +224,12 @@ start_postmaster(void)
...
@@ -224,11 +224,12 @@ start_postmaster(void)
/* Does '&' work on Win32? */
/* Does '&' work on Win32? */
if
(
log_file
!=
NULL
)
if
(
log_file
!=
NULL
)
snprintf
(
cmd
,
MAXPGPATH
,
"'%s' %s < %s >> '%s' 2>&1 &"
,
snprintf
(
cmd
,
MAXPGPATH
,
"%s
\"
%s
\"
%s < %s >>
\"
%s
\"
2>&1 &%s"
,
postgres_path
,
post_opts
,
DEVNULL
,
log_file
);
SYSTEMQUOTE
,
postgres_path
,
post_opts
,
DEVNULL
,
log_file
,
SYSTEMQUOTE
);
else
else
snprintf
(
cmd
,
MAXPGPATH
,
"
'%s' %s < %s 2>&1 &
"
,
snprintf
(
cmd
,
MAXPGPATH
,
"
%s
\"
%s
\"
%s <
\"
%s
\"
2>&1 &%s
"
,
postgres_path
,
post_opts
,
DEVNULL
);
SYSTEMQUOTE
,
postgres_path
,
post_opts
,
DEVNULL
,
SYSTEMQUOTE
);
return
system
(
cmd
);
return
system
(
cmd
);
}
}
...
...
src/bin/pg_dump/pg_dumpall.c
View file @
10a3d19a
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
*
*
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.4
0 2004/06/09 17:37:28
momjian Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.4
1 2004/06/10 16:35:17
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -690,7 +690,8 @@ runPgDump(const char *dbname)
...
@@ -690,7 +690,8 @@ runPgDump(const char *dbname)
const
char
*
p
;
const
char
*
p
;
int
ret
;
int
ret
;
appendPQExpBuffer
(
cmd
,
"'%s' %s -Fp '"
,
pg_dump_bin
,
pgdumpopts
->
data
);
appendPQExpBuffer
(
cmd
,
"%s
\"
%s
\"
%s -Fp '"
,
SYSTEMQUOTE
,
pg_dump_bin
,
pgdumpopts
->
data
);
/* Shell quoting is not quite like SQL quoting, so can't use fmtId */
/* Shell quoting is not quite like SQL quoting, so can't use fmtId */
for
(
p
=
dbname
;
*
p
;
p
++
)
for
(
p
=
dbname
;
*
p
;
p
++
)
...
@@ -702,6 +703,7 @@ runPgDump(const char *dbname)
...
@@ -702,6 +703,7 @@ runPgDump(const char *dbname)
}
}
appendPQExpBufferChar
(
cmd
,
'\''
);
appendPQExpBufferChar
(
cmd
,
'\''
);
appendStringLiteral
(
cmd
,
SYSTEMQUOTE
,
false
);
if
(
verbose
)
if
(
verbose
)
fprintf
(
stderr
,
_
(
"%s: running
\"
%s
\"\n
"
),
progname
,
cmd
->
data
);
fprintf
(
stderr
,
_
(
"%s: running
\"
%s
\"\n
"
),
progname
,
cmd
->
data
);
...
...
src/include/port.h
View file @
10a3d19a
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/port.h,v 1.4
0 2004/06/03 00:07:3
8 momjian Exp $
* $PostgreSQL: pgsql/src/include/port.h,v 1.4
1 2004/06/10 16:35:1
8 momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -72,6 +72,18 @@ extern int find_other_exec(const char *argv0, const char *target,
...
@@ -72,6 +72,18 @@ extern int find_other_exec(const char *argv0, const char *target,
#define DEVNULL "/dev/null"
#define DEVNULL "/dev/null"
#endif
#endif
/*
* Win32 needs double quotes at the beginning and end of system()
* strings. If not, it gets confused with multiple quoted strings.
* It also must use double-quotes around the executable name
* and any files use for redirection. Other args can use single-quotes.
*/
#ifdef WIN32
#define SYSTEMQUOTE "\""
#else
#define SYSTEMQUOTE ""
#endif
/* Portable delay handling */
/* Portable delay handling */
extern
void
pg_usleep
(
long
microsec
);
extern
void
pg_usleep
(
long
microsec
);
...
...
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