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.
This commit is contained in:
Benno Schulenberg 2022-07-13 16:18:15 +02:00
parent 18a40caa48
commit 34238dc119

View File

@ -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, "/");
}