kern___realpathat(): style

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D47739
This commit is contained in:
Konstantin Belousov 2024-11-25 14:41:17 +02:00
parent af1ef35a00
commit 31784ee1e3

View File

@ -3265,6 +3265,8 @@ kern___realpathat(struct thread *td, int fd, const char *path, char *buf,
if (nd.ni_vp->v_type == VREG && nd.ni_dvp->v_type != VDIR &&
(nd.ni_vp->v_vflag & VV_ROOT) != 0) {
struct vnode *covered_vp;
/*
* This happens if vp is a file mount. The call to
* vn_fullpath_hardlink can panic if path resolution can't be
@ -3274,7 +3276,6 @@ kern___realpathat(struct thread *td, int fd, const char *path, char *buf,
* this should have a unique global path since we disallow
* mounting on linked files.
*/
struct vnode *covered_vp;
error = vn_lock(nd.ni_vp, LK_SHARED);
if (error != 0)
goto out;
@ -3284,8 +3285,9 @@ kern___realpathat(struct thread *td, int fd, const char *path, char *buf,
error = vn_fullpath(covered_vp, &retbuf, &freebuf);
vrele(covered_vp);
} else {
error = vn_fullpath_hardlink(nd.ni_vp, nd.ni_dvp, nd.ni_cnd.cn_nameptr,
nd.ni_cnd.cn_namelen, &retbuf, &freebuf, &size);
error = vn_fullpath_hardlink(nd.ni_vp, nd.ni_dvp,
nd.ni_cnd.cn_nameptr, nd.ni_cnd.cn_namelen, &retbuf,
&freebuf, &size);
}
if (error == 0) {
error = copyout(retbuf, buf, size);