* Common routine for chroot and chdir. Callers must provide a locked vnode * instance. */
| 1003 | * instance. |
| 1004 | */ |
| 1005 | int |
| 1006 | change_dir(struct vnode *vp, struct thread *td) |
| 1007 | { |
| 1008 | #ifdef MAC |
| 1009 | int error; |
| 1010 | #endif |
| 1011 | |
| 1012 | ASSERT_VOP_LOCKED(vp, "change_dir(): vp not locked"); |
| 1013 | if (vp->v_type != VDIR) |
| 1014 | return (ENOTDIR); |
| 1015 | #ifdef MAC |
| 1016 | error = mac_vnode_check_chdir(td->td_ucred, vp); |
| 1017 | if (error != 0) |
| 1018 | return (error); |
| 1019 | #endif |
| 1020 | return (VOP_ACCESS(vp, VEXEC, td->td_ucred, td)); |
| 1021 | } |
| 1022 | |
| 1023 | static __inline void |
| 1024 | flags_to_rights(int flags, cap_rights_t *rightsp) |
no test coverage detected