path-util: fix off by one issue to detect slash at the end in path_extend()

This commit is contained in:
Yu Watanabe
2021-05-28 13:41:23 +09:00
parent 05575a104b
commit 340cd6b6f9
2 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -597,7 +597,7 @@ char* path_extend_internal(char **x, ...) {
*x = nx;
if (old_sz > 0)
slash = nx[old_sz] == '/';
slash = nx[old_sz-1] == '/';
else {
nx[old_sz] = 0;
slash = true; /* no need to generate a slash anymore */