diff options
Diffstat (limited to 'lib/libc/sys')
-rw-r--r-- | lib/libc/sys/Makefile.inc | 6 | ||||
-rw-r--r-- | lib/libc/sys/chown.2 | 26 |
2 files changed, 24 insertions, 8 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 172d042cc5e..2aa857aec8f 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -22,9 +22,9 @@ ASM= accept.o access.o acct.o adjtime.o bind.o chdir.o chflags.o chmod.o \ getpgrp.o getpid.o getppid.o getpriority.o getrlimit.o getrusage.o \ getsockname.o getsockopt.o gettimeofday.o getuid.o issetugid.o \ ioctl.o kill.o \ - ktrace.o lfs_bmapv.o lfs_markv.o lfs_segclean.o lfs_segwait.o link.o \ - listen.o lstat.o madvise.o mincore.o minherit.o mkdir.o mkfifo.o \ - mknod.o mlock.o \ + ktrace.o lchown.o lfs_bmapv.o lfs_markv.o lfs_segclean.o lfs_segwait.o \ + link.o listen.o lstat.o madvise.o mincore.o minherit.o mkdir.o \ + mkfifo.o mknod.o mlock.o \ mount.o mprotect.o msgctl.o msgget.o msgrcv.o msgsnd.o msync.o \ munlock.o munmap.o nfssvc.o \ ntp_gettime.o ntp_adjtime.o \ diff --git a/lib/libc/sys/chown.2 b/lib/libc/sys/chown.2 index 94d8972727f..3b194b6d33c 100644 --- a/lib/libc/sys/chown.2 +++ b/lib/libc/sys/chown.2 @@ -1,3 +1,4 @@ +.\" $OpenBSD: chown.2,v 1.3 1997/01/26 05:10:33 downsj Exp $ .\" $NetBSD: chown.2,v 1.10 1995/10/12 15:40:47 jtc Exp $ .\" .\" Copyright (c) 1980, 1991, 1993, 1994 @@ -33,22 +34,25 @@ .\" .\" @(#)chown.2 8.4 (Berkeley) 4/19/94 .\" -.Dd April 19, 1994 +.Dd January 25, 1997 .Dt CHOWN 2 -.Os BSD 4 +.Os .Sh NAME .Nm chown , +.Nm lchown , .Nm fchown -.Nd change owner and group of a file +.Nd change owner and group of a file or link .Sh SYNOPSIS .Fd #include <sys/types.h> .Fd #include <unistd.h> .Ft int .Fn chown "const char *path" "uid_t owner" "gid_t group" .Ft int +.Fn lchown "const char *path" "uid_t owner" "gid_t group" +.Ft int .Fn fchown "int fd" "uid_t owner" "gid_t group" .Sh DESCRIPTION -The owner ID and group ID of the file +The owner ID and group ID of the file (or link) named by .Fa path or referenced by @@ -71,6 +75,12 @@ on the file to prevent accidental or mischievous creation of set-user-id and set-group-id programs. .Pp +.Fn Lchown +operates similarly to how +.Fn chown +operated on older systems, and does not follow symbolic links. +It allows the owner and group of a symbolic link to be set. +.Pp .Fn Fchown is particularly useful when used in conjunction with the file locking primitives (see @@ -85,7 +95,9 @@ error code being placed in the global variable .Va errno . .Sh ERRORS .Fn Chown -will fail and the file will be unchanged if: +or +.Fn lchown +will fail and the file or link will be unchanged if: .Bl -tag -width Er .It Bq Er ENOTDIR A component of the path prefix is not a directory. @@ -150,3 +162,7 @@ and .Fn fchown functions were changed to follow symbolic links in .Bx 4.4 . +.Pp +The +.Fn lchown +function was added to OpenBSD due to the above. |