When a Linux program tries to access a /path the kernel tries
/compat/linux/path before /path. Stop following symbolic links when looking up /compat/linux/path so dead symbolic links aren't ignored. This allows syscalls like readlink(2) and lstat(2) to work on such links. And open(2) will return an error now instead of trying /path.
This commit is contained in:
parent
29431e54b9
commit
11ce4d9f39
@ -1390,13 +1390,13 @@ kern_alternate_path(struct thread *td, const char *prefix, const char *path,
|
||||
for (cp = &ptr[len] - 1; *cp != '/'; cp--);
|
||||
*cp = '\0';
|
||||
|
||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, td);
|
||||
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, buf, td);
|
||||
error = namei(&nd);
|
||||
*cp = '/';
|
||||
if (error != 0)
|
||||
goto keeporig;
|
||||
} else {
|
||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, td);
|
||||
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, buf, td);
|
||||
|
||||
error = namei(&nd);
|
||||
if (error != 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user