| 2976 | } |
| 2977 | |
| 2978 | int |
| 2979 | kern_fchownat(struct thread *td, int fd, const char *path, |
| 2980 | enum uio_seg pathseg, int uid, int gid, int flag) |
| 2981 | { |
| 2982 | struct nameidata nd; |
| 2983 | int error; |
| 2984 | |
| 2985 | AUDIT_ARG_OWNER(uid, gid); |
| 2986 | NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(flag, AT_SYMLINK_NOFOLLOW | |
| 2987 | AT_RESOLVE_BENEATH) | AUDITVNODE1, pathseg, path, fd, |
| 2988 | &cap_fchown_rights, td); |
| 2989 | |
| 2990 | if ((error = namei(&nd)) != 0) |
| 2991 | return (error); |
| 2992 | NDFREE_NOTHING(&nd); |
| 2993 | error = setfown(td, td->td_ucred, nd.ni_vp, uid, gid); |
| 2994 | vrele(nd.ni_vp); |
| 2995 | return (error); |
| 2996 | } |
| 2997 | |
| 2998 | /* |
| 2999 | * Set ownership given a path name, do not cross symlinks. |
no test coverage detected