diff options
author | Peter Wemm <peter@FreeBSD.org> | 1997-03-31 12:21:37 +0000 |
---|---|---|
committer | Peter Wemm <peter@FreeBSD.org> | 1997-03-31 12:21:37 +0000 |
commit | 57862eed2206f349d094d01ed30c25253de1efe3 (patch) | |
tree | 5a959d05e46e9e708682f9fea65022dd3f607e84 /sys/kern/vfs_syscalls.c | |
parent | f77da2867aa26357bb7d7aa8a9d417748c572beb (diff) | |
download | src-test2-57862eed2206f349d094d01ed30c25253de1efe3.tar.gz src-test2-57862eed2206f349d094d01ed30c25253de1efe3.zip |
Notes
Diffstat (limited to 'sys/kern/vfs_syscalls.c')
-rw-r--r-- | sys/kern/vfs_syscalls.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index ffc796f4c58a..d97f1cafe7ad 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 - * $Id: vfs_syscalls.c,v 1.61 1997/03/23 20:08:11 guido Exp $ + * $Id: vfs_syscalls.c,v 1.62 1997/03/31 12:02:42 peter Exp $ */ /* @@ -1868,6 +1868,46 @@ chown(p, uap, retval) } /* + * Set ownership given a path name, do not cross symlinks. + */ +#ifndef _SYS_SYSPROTO_H_ +struct lchown_args { + char *path; + int uid; + int gid; +}; +#endif +/* ARGSUSED */ +int +lchown(p, uap, retval) + struct proc *p; + register struct lchown_args /* { + syscallarg(char *) path; + syscallarg(int) uid; + syscallarg(int) gid; + } */ *uap; + register_t *retval; +{ + register struct vnode *vp; + struct vattr vattr; + int error; + struct nameidata nd; + + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), p); + if (error = namei(&nd)) + return (error); + vp = nd.ni_vp; + VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + VATTR_NULL(&vattr); + vattr.va_uid = SCARG(uap, uid); + vattr.va_gid = SCARG(uap, gid); + error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); + vput(vp); + return (error); +} + +/* * Set ownership given a file descriptor. */ #ifndef _SYS_SYSPROTO_H_ |