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

Function can_hardlink

freebsd/kern/vfs_syscalls.c:1520–1546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1518 "groups");
1519
1520static int
1521can_hardlink(struct vnode *vp, struct ucred *cred)
1522{
1523 struct vattr va;
1524 int error;
1525
1526 if (!hardlink_check_uid && !hardlink_check_gid)
1527 return (0);
1528
1529 error = VOP_GETATTR(vp, &va, cred);
1530 if (error != 0)
1531 return (error);
1532
1533 if (hardlink_check_uid && cred->cr_uid != va.va_uid) {
1534 error = priv_check_cred(cred, PRIV_VFS_LINK);
1535 if (error != 0)
1536 return (error);
1537 }
1538
1539 if (hardlink_check_gid && !groupmember(va.va_gid, cred)) {
1540 error = priv_check_cred(cred, PRIV_VFS_LINK);
1541 if (error != 0)
1542 return (error);
1543 }
1544
1545 return (0);
1546}
1547
1548int
1549kern_linkat(struct thread *td, int fd1, int fd2, const char *path1,

Callers 1

kern_linkat_vpFunction · 0.85

Calls 3

VOP_GETATTRFunction · 0.85
priv_check_credFunction · 0.70
groupmemberFunction · 0.70

Tested by

no test coverage detected