dirname: Parse one-character paths properly
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
apio 2023-04-16 11:25:47 +02:00
parent e6954d2e49
commit 3b4214c8be
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -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--; }