Skip to content

Commit fd6dbc2

Browse files
committed
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.
1 parent dea5f6c commit fd6dbc2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/port/path.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ join_path_components(char *ret_path,
212212
}
213213
if (*tail)
214214
snprintf(ret_path + strlen(ret_path), MAXPGPATH - strlen(ret_path),
215-
"/%s", tail);
215+
/* only add slash if there is something already in head */
216+
"%s%s", head[0] ? "/" : "", tail);
216217
}
217218

218219

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy