PERFORCE change 101567 for review
John Baldwin
jhb at FreeBSD.org
Fri Jul 14 16:01:30 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=101567
Change 101567 by jhb at jhb_mutex on 2006/07/14 16:01:09
Use change_dir() in fchdir() instead of duplicating the logic.
Affected files ...
.. //depot/projects/smpng/sys/compat/svr4/svr4_misc.c#50 edit
.. //depot/projects/smpng/sys/compat/svr4/syscalls.master#18 edit
.. //depot/projects/smpng/sys/kern/vfs_syscalls.c#111 edit
Differences ...
==== //depot/projects/smpng/sys/compat/svr4/svr4_misc.c#50 (text+ko) ====
@@ -606,34 +606,31 @@
struct svr4_sys_fchroot_args *uap;
{
struct filedesc *fdp = td->td_proc->p_fd;
- struct vnode *vp, *vpold;
+ struct vnode *vp;
struct file *fp;
- int error;
+ int error, vfslocked;
if ((error = suser(td)) != 0)
return error;
+ AUDIT_ARG(fd, uap->fd);
if ((error = getvnode(fdp, uap->fd, &fp)) != 0)
return error;
vp = fp->f_vnode;
+ VREF(vp);
+ fdrop(fp, td);
+ vfslocked = VFS_LOCK_GIANT(vp->v_mount);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- if (vp->v_type != VDIR)
- error = ENOTDIR;
- else
- error = VOP_ACCESS(vp, VEXEC, td->td_ucred, td);
+ AUDIT_ARG(vnode, vp, ARG_VNODE1);
+ error = change_dir(vp, td);
+#ifdef MAC
+ if (error == 0)
+ error = mac_check_vnode_chroot(td->td_ucred, vp);
+#endif
VOP_UNLOCK(vp, 0, td);
- if (error) {
- fdrop(fp, td);
- return error;
- }
- VREF(vp);
- FILEDESC_LOCK_FAST(fdp);
- vpold = fdp->fd_rdir;
- fdp->fd_rdir = vp;
- FILEDESC_UNLOCK_FAST(fdp);
- if (vpold != NULL)
- vrele(vpold);
- fdrop(fp, td);
- return 0;
+ if (error == 0)
+ error = change_root(vp, td);
+ VFS_UNLOCK_GIANT(vfslocked);
+ return (error);
}
==== //depot/projects/smpng/sys/compat/svr4/syscalls.master#18 (text+ko) ====
@@ -250,7 +250,7 @@
150 AUE_NULL UNIMPL notused
151 AUE_NULL UNIMPL notused
152 AUE_NULL UNIMPL modctl
-153 AUE_NULL STD { int svr4_sys_fchroot(int fd); }
+153 AUE_NULL MSTD { int svr4_sys_fchroot(int fd); }
154 AUE_NULL MSTD { int svr4_sys_utimes(char *path, \
struct timeval *tptr); }
155 AUE_NULL MSTD { int svr4_sys_vhangup(void); }
==== //depot/projects/smpng/sys/kern/vfs_syscalls.c#111 (text+ko) ====
@@ -697,14 +697,7 @@
vfslocked = VFS_LOCK_GIANT(vp->v_mount);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
AUDIT_ARG(vnode, vp, ARG_VNODE1);
- if (vp->v_type != VDIR)
- error = ENOTDIR;
-#ifdef MAC
- else if ((error = mac_check_vnode_chdir(td->td_ucred, vp)) != 0) {
- }
-#endif
- else
- error = VOP_ACCESS(vp, VEXEC, td->td_ucred, td);
+ error = change_dir(vp, td);
while (!error && (mp = vp->v_mountedhere) != NULL) {
int tvfslocked;
if (vfs_busy(mp, 0, 0, td))
More information about the p4-projects
mailing list