From 3b4214c8be1c39510f6350727a2819e116dacf34 Mon Sep 17 00:00:00 2001 From: apio Date: Sun, 16 Apr 2023 11:25:47 +0200 Subject: [PATCH] dirname: Parse one-character paths properly --- libluna/src/CPath.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libluna/src/CPath.cpp b/libluna/src/CPath.cpp index 0fe5e8af..4a503fe7 100644 --- a/libluna/src/CPath.cpp +++ b/libluna/src/CPath.cpp @@ -32,6 +32,8 @@ extern "C" usize len = strlen(path); if (!len) return dot; + if (len == 1 && *path != '/') return dot; + // Strip trailing slashes. char* it = path + len - 1; while (*it == '/' && it != path) { it--; }