libc: remove trailing slash in lstat and stat

Fixes #3814.
This commit is contained in:
Josef Söntgen 2020-06-29 17:28:36 +02:00 committed by Norman Feske
parent c4a8c6798b
commit 49e907e5f6

View File

@ -374,6 +374,7 @@ extern "C" int lstat(const char *path, struct stat *buf)
try {
Absolute_path resolved_path;
resolve_symlinks_except_last_element(path, resolved_path);
resolved_path.remove_trailing('/');
FNAME_FUNC_WRAPPER(stat, resolved_path.base(), buf);
} catch (Symlink_resolve_error) {
return -1;
@ -649,6 +650,7 @@ extern "C" int stat(const char *path, struct stat *buf)
try {
Absolute_path resolved_path;
resolve_symlinks(path, resolved_path);
resolved_path.remove_trailing('/');
FNAME_FUNC_WRAPPER(stat, resolved_path.base(), buf);
} catch(Symlink_resolve_error) {
return -1;