diff options
| author | Tom Lane | 2014-04-04 22:42:13 +0000 |
|---|---|---|
| committer | Tom Lane | 2014-04-04 22:42:13 +0000 |
| commit | 9aca51250681d2e8d18ed1d73e7cd1283d1cf303 (patch) | |
| tree | b1b9e945db659fd59bbdf8aacf3f21aad18f5b15 /src/bin | |
| parent | 8120c7452a51a773ad7a249b55557439f39d41ef (diff) | |
Make sure -D is an absolute path when starting server on Windows.
This is needed because Windows services may get started with a different
current directory than where pg_ctl is executed. We want relative -D
paths to be interpreted relative to pg_ctl's CWD, similarly to what
happens on other platforms.
In support of this, move the backend's make_absolute_path() function
into src/port/path.c (where it probably should have been long since)
and get rid of the rather inferior version in pg_regress.
Kumar Rajeev Rastogi, reviewed by MauMau
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/pg_ctl/pg_ctl.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c index 56d238f3948..1f921819c23 100644 --- a/src/bin/pg_ctl/pg_ctl.c +++ b/src/bin/pg_ctl/pg_ctl.c @@ -1387,7 +1387,19 @@ pgwin32_CommandLine(bool registration) register_servicename); if (pg_config) - appendPQExpBuffer(cmdLine, " -D \"%s\"", pg_config); + { + /* We need the -D path to be absolute */ + char *dataDir; + + if ((dataDir = make_absolute_path(pg_config)) == NULL) + { + /* make_absolute_path already reported the error */ + exit(1); + } + make_native_path(dataDir); + appendPQExpBuffer(cmdLine, " -D \"%s\"", dataDir); + free(dataDir); + } if (registration && do_wait) appendPQExpBuffer(cmdLine, " -w"); |
