kernel/vfs: lstat a symlinked dir with a trailing slash should traverse
golang's TestSymlinkWithTrailingSlash exhibits the bug. Change-Id: I7e16bad9857e9be042fc215a587c861bc4eef716 Reviewed-on: https://review.haiku-os.org/c/haiku/+/5395 Reviewed-by: waddlesplash <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
c95c5ed821
commit
e49b671dcf
@@ -2179,7 +2179,9 @@ vnode_path_to_vnode(struct vnode* vnode, char* path, bool traverseLeafLink,
|
|||||||
for (nextPath = path + 1; *nextPath != '\0' && *nextPath != '/';
|
for (nextPath = path + 1; *nextPath != '\0' && *nextPath != '/';
|
||||||
nextPath++);
|
nextPath++);
|
||||||
|
|
||||||
|
bool directoryFound = false;
|
||||||
if (*nextPath == '/') {
|
if (*nextPath == '/') {
|
||||||
|
directoryFound = true;
|
||||||
*nextPath = '\0';
|
*nextPath = '\0';
|
||||||
do
|
do
|
||||||
nextPath++;
|
nextPath++;
|
||||||
@@ -2226,7 +2228,7 @@ vnode_path_to_vnode(struct vnode* vnode, char* path, bool traverseLeafLink,
|
|||||||
// If the new node is a symbolic link, resolve it (if we've been told
|
// If the new node is a symbolic link, resolve it (if we've been told
|
||||||
// to do it)
|
// to do it)
|
||||||
if (S_ISLNK(nextVnode->Type())
|
if (S_ISLNK(nextVnode->Type())
|
||||||
&& (traverseLeafLink || nextPath[0] != '\0')) {
|
&& (traverseLeafLink || directoryFound)) {
|
||||||
size_t bufferSize;
|
size_t bufferSize;
|
||||||
char* buffer;
|
char* buffer;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user