| 936 | } |
| 937 | |
| 938 | int |
| 939 | kern_chdir(struct thread *td, const char *path, enum uio_seg pathseg) |
| 940 | { |
| 941 | struct nameidata nd; |
| 942 | int error; |
| 943 | |
| 944 | NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1, |
| 945 | pathseg, path, td); |
| 946 | if ((error = namei(&nd)) != 0) |
| 947 | return (error); |
| 948 | if ((error = change_dir(nd.ni_vp, td)) != 0) { |
| 949 | vput(nd.ni_vp); |
| 950 | NDFREE_NOTHING(&nd); |
| 951 | return (error); |
| 952 | } |
| 953 | VOP_UNLOCK(nd.ni_vp); |
| 954 | NDFREE_NOTHING(&nd); |
| 955 | pwd_chdir(td, nd.ni_vp); |
| 956 | return (0); |
| 957 | } |
| 958 | |
| 959 | /* |
| 960 | * Change notion of root (``/'') directory. |
no test coverage detected