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

Function mqf_chown

freebsd/kern/uipc_mqueue.c:2581–2604  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2579}
2580
2581static int
2582mqf_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred,
2583 struct thread *td)
2584{
2585 struct mqfs_node *pn;
2586 int error;
2587
2588 error = 0;
2589 pn = fp->f_data;
2590 sx_xlock(&mqfs_data.mi_lock);
2591 if (uid == (uid_t)-1)
2592 uid = pn->mn_uid;
2593 if (gid == (gid_t)-1)
2594 gid = pn->mn_gid;
2595 if (((uid != pn->mn_uid && uid != active_cred->cr_uid) ||
2596 (gid != pn->mn_gid && !groupmember(gid, active_cred))) &&
2597 (error = priv_check_cred(active_cred, PRIV_VFS_CHOWN)))
2598 goto out;
2599 pn->mn_uid = uid;
2600 pn->mn_gid = gid;
2601out:
2602 sx_xunlock(&mqfs_data.mi_lock);
2603 return (error);
2604}
2605
2606static int
2607mqf_kqfilter(struct file *fp, struct knote *kn)

Callers

nothing calls this directly

Calls 2

groupmemberFunction · 0.70
priv_check_credFunction · 0.70

Tested by

no test coverage detected