summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian2011-11-26 14:27:11 +0000
committerBruce Momjian2011-11-26 14:27:11 +0000
commitfd6dbc24ef1dc6b39a795b5e0e959cf500ad71d6 (patch)
tree4ebca23fc6975297f5aaab29cbc041162122636e
parentdea5f6cefe74a6cb51a1cfd39e12a2e1a026df35 (diff)
Fix join_path_components() to not add a leading slash when joining to an
initial null string. Per report from Robert Haas in testing psql \ir.
-rw-r--r--src/port/path.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/port/path.c b/src/port/path.c
index 13ca4f3f1c..9cb0b01644 100644
--- a/src/port/path.c
+++ b/src/port/path.c
@@ -212,7 +212,8 @@ join_path_components(char *ret_path,
}
if (*tail)
snprintf(ret_path + strlen(ret_path), MAXPGPATH - strlen(ret_path),
- "/%s", tail);
+ /* only add slash if there is something already in head */
+ "%s%s", head[0] ? "/" : "", tail);
}