dirname: Parse one-character paths properly
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
e6954d2e49
commit
3b4214c8be
@ -32,6 +32,8 @@ extern "C"
|
|||||||
usize len = strlen(path);
|
usize len = strlen(path);
|
||||||
if (!len) return dot;
|
if (!len) return dot;
|
||||||
|
|
||||||
|
if (len == 1 && *path != '/') return dot;
|
||||||
|
|
||||||
// Strip trailing slashes.
|
// Strip trailing slashes.
|
||||||
char* it = path + len - 1;
|
char* it = path + len - 1;
|
||||||
while (*it == '/' && it != path) { it--; }
|
while (*it == '/' && it != path) { it--; }
|
||||||
|
Loading…
Reference in New Issue
Block a user