Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
5fe8c7d6
Commit
5fe8c7d6
authored
21 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
More restructuring to use Win32 START with paths needing quotes.
parent
6cc4175b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/bin/pg_ctl/pg_ctl.c
+51
-4
51 additions, 4 deletions
src/bin/pg_ctl/pg_ctl.c
with
51 additions
and
4 deletions
src/bin/pg_ctl/pg_ctl.c
+
51
−
4
View file @
5fe8c7d6
...
...
@@ -4,7 +4,7 @@
*
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.1
3
2004/06/1
0 22:20:53
momjian Exp $
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.1
4
2004/06/1
1 00:57:25
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -221,6 +221,41 @@ start_postmaster(void)
* to pass everything to a shell to process them.
*/
char
cmd
[
MAXPGPATH
];
int
ret
;
char
*
pgexec
=
postgres_path
;
#ifdef WIN32
/*
* Win32 has a problem with the interaction between START and system().
* There is no way to quote the executable name passed to START.
* Therefore, we put the executable name in a temporary batch file
* and run it via START.
*/
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
)
/* Win32 needs START /B rather than "&" */
...
...
@@ -229,7 +264,7 @@ start_postmaster(void)
#else
snprintf
(
cmd
,
MAXPGPATH
,
"%sSTART /B
\"
%s
\"
%s <
\"
%s
\"
>>
\"
%s
\"
2>&1%s"
,
#endif
SYSTEMQUOTE
,
p
ostgres_path
,
post_opts
,
DEVNULL
,
log_file
,
SYSTEMQUOTE
,
p
gexec
,
post_opts
,
DEVNULL
,
log_file
,
SYSTEMQUOTE
);
else
#ifndef WIN32
...
...
@@ -237,8 +272,20 @@ start_postmaster(void)
#else
snprintf
(
cmd
,
MAXPGPATH
,
"%sSTART /B
\"
%s
\"
%s <
\"
%s
\"
2>&1%s"
,
#endif
SYSTEMQUOTE
,
postgres_path
,
post_opts
,
DEVNULL
,
SYSTEMQUOTE
);
return
system
(
cmd
);
SYSTEMQUOTE
,
pgexec
,
post_opts
,
DEVNULL
,
SYSTEMQUOTE
);
ret
=
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
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment