summaryrefslogtreecommitdiff
path: root/src/port/exec.c
diff options
context:
space:
mode:
authorTom Lane2004-08-09 20:20:47 +0000
committerTom Lane2004-08-09 20:20:47 +0000
commitb06c90764526ccf291011ecbbcab49ae9729f65a (patch)
treefa8c61fb9f807e58fb098b9d565a698f0fde9fde /src/port/exec.c
parent35f539b481b5524bd331cb7b75df848da51b43e5 (diff)
Path-mangling logic was failing to account for paths containing mentions
of '.' or '..'. Extend canonicalize_path() to trim off trailing occurrences of these things, and use it to fix up paths where needed (which I think is only after places where we trim the last path component, but maybe some others will turn up). Fixes Josh's complaint that './initdb' does not work.
Diffstat (limited to 'src/port/exec.c')
-rw-r--r--src/port/exec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/port/exec.c b/src/port/exec.c
index 440c63f0c52..85fec3ac478 100644
--- a/src/port/exec.c
+++ b/src/port/exec.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/exec.c,v 1.20 2004/08/09 03:12:38 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/exec.c,v 1.21 2004/08/09 20:20:46 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -433,6 +433,9 @@ find_other_exec(const char *argv0, const char *target,
/* Trim off program name and keep just directory */
*last_dir_separator(retpath) = '\0';
+ canonicalize_path(retpath);
+
+ /* Now append the other program's name */
snprintf(retpath + strlen(retpath), MAXPGPATH - strlen(retpath),
"/%s%s", target, EXE);