O_RELATIVE_BENEATH: return ENOTCAPABLE instead of EINVAL for abs path

Requested and reviewed by:	markj
Tested by:	arichardson,  pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D28907
This commit is contained in:
Konstantin Belousov 2021-03-01 01:59:12 +02:00
parent 49c98a4bf3
commit 28cd3a673e

View File

@ -405,7 +405,7 @@ namei_setup(struct nameidata *ndp, struct vnode **dpp, struct pwd **pwdp)
}
if (error == 0 && (cnp->cn_flags & RBENEATH) != 0) {
if (cnp->cn_pnbuf[0] == '/') {
error = EINVAL;
error = ENOTCAPABLE;
} else if ((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) == 0) {
ndp->ni_lcf |= NI_LCF_STRICTRELATIVE |
NI_LCF_CAP_DOTDOT;