From 34238dc1199b9bd1bf94c4bc59e4bad744d0d698 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 13 Jul 2022 16:18:15 +0200 Subject: [PATCH] files: designate the root directory with a simple "/", not with "//" The double slash would derail the file browser, causing a crash. This fixes https://savannah.gnu.org/bugs/?62760. Reported-by: Frank Wolff Bug existed since version 6.3, commit fdd946c0. --- src/files.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/files.c b/src/files.c index 852bb24a..38adcea7 100644 --- a/src/files.c +++ b/src/files.c @@ -1379,8 +1379,9 @@ char *get_full_path(const char *origpath) } } - /* Ensure that a directory path ends with a slash. */ - if (target && stat(target, &fileinfo) == 0 && S_ISDIR(fileinfo.st_mode)) { + /* Ensure that a non-apex directory path ends with a slash. */ + if (target && target[1] && stat(target, &fileinfo) == 0 && + S_ISDIR(fileinfo.st_mode)) { target = nrealloc(target, strlen(target) + 2); strcat(target, "/"); }