Put the vnode returned from namei() immediately after namei() returns in

svr4_sys_resolvepath().
This commit is contained in:
John Baldwin 2009-05-20 18:25:16 +00:00
parent 1d631ee69a
commit 63ba66086a

View File

@ -1611,14 +1611,14 @@ svr4_sys_resolvepath(td, uap)
struct nameidata nd;
int error, *retval = td->td_retval;
unsigned int ncopy;
int vfslocked;
NDINIT(&nd, LOOKUP, NOFOLLOW | SAVENAME | MPSAFE, UIO_USERSPACE,
uap->path, td);
if ((error = namei(&nd)) != 0)
return error;
vfslocked = NDHASGIANT(&nd);
return (error);
NDFREE(&nd, NDF_NO_FREE_PNBUF);
VFS_UNLOCK_GIANT(NDHASGIANT(&nd));
ncopy = min(uap->bufsiz, strlen(nd.ni_cnd.cn_pnbuf) + 1);
if ((error = copyout(nd.ni_cnd.cn_pnbuf, uap->buf, ncopy)) != 0)
@ -1627,7 +1627,5 @@ svr4_sys_resolvepath(td, uap)
*retval = ncopy;
bad:
NDFREE(&nd, NDF_ONLY_PNBUF);
vput(nd.ni_vp);
VFS_UNLOCK_GIANT(vfslocked);
return error;
}