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
8d64b562
Commit
8d64b562
authored
Jun 11, 2004
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup use of Win32 START by using "" for title. No need for temp
batch files anymore.
parent
800910fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
51 deletions
+13
-51
src/bin/pg_ctl/pg_ctl.c
src/bin/pg_ctl/pg_ctl.c
+13
-51
No files found.
src/bin/pg_ctl/pg_ctl.c
View file @
8d64b562
...
@@ -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.1
5 2004/06/11 04:17:2
1 momjian Exp $
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.1
6 2004/06/11 16:36:3
1 momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -221,71 +221,33 @@ start_postmaster(void)
...
@@ -221,71 +221,33 @@ start_postmaster(void)
* to pass everything to a shell to process them.
* to pass everything to a shell to process them.
*/
*/
char
cmd
[
MAXPGPATH
];
char
cmd
[
MAXPGPATH
];
int
ret
;
char
*
pgexec
=
postgres_path
;
#ifdef WIN32
/*
/*
* Win32 has a problem with the interaction between START and system().
* Win32 needs START /B rather than "&".
* There is no way to quote the executable name passed to START.
*
* Therefore, we put the executable name in a temporary batch file
* Win32 has a problem with START and quoted executable names.
* and run it via START.
* You must add a "" as the title at the beginning so you can quote
* the executable name:
* http://www.winnetmag.com/Article/ArticleID/14589/14589.html
* http://dev.remotenetworktechnology.com/cmd/cmdfaq.htm
*/
*/
char
tmp
[
MAXPGPATH
]
=
"C:
\\
PG_CTL_XXXXXX"
,
/* good location? */
bat
[
MAXPGPATH
];
int
fd
=
mkstemp
(
tmp
);
if
(
fd
==
-
1
)
{
fprintf
(
stderr
,
_
(
"%s: cannot create batch file %s to start server: %s
\n
"
),
progname
,
tmp
,
strerror
(
errno
));
exit
(
1
);
}
write
(
fd
,
postgres_path
,
strlen
(
postgres_path
));
write
(
fd
,
"
\n
"
,
1
);
close
(
fd
);
strcpy
(
bat
,
tmp
);
strcat
(
bat
,
".BAT"
);
pgexec
=
bat
;
if
(
rename
(
tmp
,
bat
)
==
-
1
)
{
fprintf
(
stderr
,
_
(
"%s: cannot rename batch file %s to %s: %s
\n
"
),
progname
,
tmp
,
bat
,
strerror
(
errno
));
unlink
(
tmp
);
exit
(
1
);
}
#endif
if
(
log_file
!=
NULL
)
if
(
log_file
!=
NULL
)
/* Win32 needs START /B rather than "&" */
#ifndef WIN32
#ifndef WIN32
snprintf
(
cmd
,
MAXPGPATH
,
"%s
\"
%s
\"
%s <
\"
%s
\"
>>
\"
%s
\"
2>&1 &%s"
,
snprintf
(
cmd
,
MAXPGPATH
,
"%s
\"
%s
\"
%s <
\"
%s
\"
>>
\"
%s
\"
2>&1 &%s"
,
#else
#else
snprintf
(
cmd
,
MAXPGPATH
,
"%sSTART /B
%s
%s <
\"
%s
\"
>>
\"
%s
\"
2>&1%s"
,
snprintf
(
cmd
,
MAXPGPATH
,
"%sSTART /B
\"\"
\"
%s
\"
%s <
\"
%s
\"
>>
\"
%s
\"
2>&1%s"
,
#endif
#endif
SYSTEMQUOTE
,
p
gexec
,
post_opts
,
DEVNULL
,
log_file
,
SYSTEMQUOTE
,
p
ostgres_path
,
post_opts
,
DEVNULL
,
log_file
,
SYSTEMQUOTE
);
SYSTEMQUOTE
);
else
else
#ifndef WIN32
#ifndef WIN32
snprintf
(
cmd
,
MAXPGPATH
,
"%s
\"
%s
\"
%s <
\"
%s
\"
2>&1 &%s"
,
snprintf
(
cmd
,
MAXPGPATH
,
"%s
\"
%s
\"
%s <
\"
%s
\"
2>&1 &%s"
,
#else
#else
snprintf
(
cmd
,
MAXPGPATH
,
"%sSTART /B
%s
%s <
\"
%s
\"
2>&1%s"
,
snprintf
(
cmd
,
MAXPGPATH
,
"%sSTART /B
\"\"
\"
%s
\"
%s <
\"
%s
\"
2>&1%s"
,
#endif
#endif
SYSTEMQUOTE
,
p
gexec
,
post_opts
,
DEVNULL
,
SYSTEMQUOTE
);
SYSTEMQUOTE
,
p
ostgres_path
,
post_opts
,
DEVNULL
,
SYSTEMQUOTE
);
ret
=
system
(
cmd
);
return
system
(
cmd
);
#ifdef WIN32
/* We are unlinking it while it is running, but that should be OK */
if
(
unlink
(
bat
))
{
fprintf
(
stderr
,
_
(
"%s: cannot remove batch file %s: %s
\n
"
),
progname
,
bat
,
strerror
(
errno
));
exit
(
1
);
}
#endif
return
ret
;
}
}
...
...
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