From 184b5be7e68fe8ef44c4eda7f338ac34eb1ffe67 Mon Sep 17 00:00:00 2001 From: Francisco Javier Trujillo Mata Date: Tue, 5 Dec 2023 13:30:27 +0100 Subject: [PATCH] Avoid removing slash when root --- ee/libcglue/src/cwd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ee/libcglue/src/cwd.c b/ee/libcglue/src/cwd.c index 20135b25d5e..2ade300e70a 100644 --- a/ee/libcglue/src/cwd.c +++ b/ee/libcglue/src/cwd.c @@ -127,10 +127,10 @@ static int __path_normalize(char *out, int len) if(!out[next]) break; } - /* Remove trailing "/" */ + /* Remove trailing "/" just if it's not the root */ for(i=1; out[i]; i++) continue; - if(i >= 1 && out[i-1] == '/') + if(i > 1 && out[i-1] == '/') out[i-1] = 0; return 0;