Skip to content

Commit d5a609f

Browse files
committed
libpreopen: Ignore trailing slashes when matching directory path names.
1 parent 240549f commit d5a609f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

libc-bottom-half/libpreopen/lib/libpreopen.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ po_isprefix(const char *dir, size_t dirlen, const char *path)
181181
if (path[i] != dir[i])
182182
return false;
183183
}
184+
// Ignore trailing slashes in directory names.
185+
while (i > 0 && dir[i - 1] == '/') {
186+
--i;
187+
}
184188
return path[i] == '/' || path[i] == '\0';
185189
}
186190

0 commit comments

Comments
 (0)