MCPcopy Create free account
hub / github.com/F-Stack/f-stack / kern_fchownat

Function kern_fchownat

freebsd/kern/vfs_syscalls.c:2978–2996  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2976}
2977
2978int
2979kern_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.

Callers 3

sys_chownFunction · 0.85
sys_fchownatFunction · 0.85
sys_lchownFunction · 0.85

Calls 5

at2cnpflagsFunction · 0.85
nameiFunction · 0.85
NDFREE_NOTHINGFunction · 0.85
setfownFunction · 0.85
vreleFunction · 0.70

Tested by

no test coverage detected