Commit fd6dbc24 authored by Bruce Momjian's avatar Bruce Momjian

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.
parent dea5f6ce
...@@ -212,7 +212,8 @@ join_path_components(char *ret_path, ...@@ -212,7 +212,8 @@ join_path_components(char *ret_path,
} }
if (*tail) if (*tail)
snprintf(ret_path + strlen(ret_path), MAXPGPATH - strlen(ret_path), 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);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment