diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 47150f1bf536..f08d5719c1e9 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -1,5 +1,5 @@ # @(#)Makefile.inc 8.3 (Berkeley) 10/24/94 -# $Id: Makefile.inc,v 1.22 1997/02/22 15:03:35 peter Exp $ +# $Id: Makefile.inc,v 1.23 1997/03/11 11:35:46 peter Exp $ # sys sources .PATH: ${.CURDIR}/${MACHINE}/sys ${.CURDIR}/sys @@ -20,7 +20,7 @@ ASM= accept.o access.o acct.o adjtime.o bind.o chdir.o chflags.o chmod.o \ geteuid.o getfh.o getfsstat.o getgid.o getgroups.o getitimer.o \ getpeername.o getpgrp.o getpid.o getppid.o getpriority.o \ getrlimit.o getrusage.o getsockname.o getsockopt.o gettimeofday.o \ - getuid.o ioctl.o kill.o ktrace.o lfs_bmapv.o lfs_markv.o \ + getuid.o ioctl.o kill.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 \ diff --git a/lib/libc/sys/chown.2 b/lib/libc/sys/chown.2 index 8cf542299d93..340d3950e057 100644 --- a/lib/libc/sys/chown.2 +++ b/lib/libc/sys/chown.2 @@ -30,14 +30,15 @@ .\" SUCH DAMAGE. .\" .\" @(#)chown.2 8.4 (Berkeley) 4/19/94 -.\" $Id$ +.\" $Id: chown.2,v 1.9 1997/02/22 15:03:44 peter Exp $ .\" .Dd April 19, 1994 .Dt CHOWN 2 .Os BSD 4 .Sh NAME .Nm chown , -.Nm fchown +.Nm fchown , +.Nm lchown .Nd change owner and group of a file .Sh SYNOPSIS .Fd #include @@ -45,6 +46,8 @@ .Fn chown "const char *path" "uid_t owner" "gid_t group" .Ft int .Fn fchown "int fd" "uid_t owner" "gid_t group" +.Ft int +.Fn lchown "const char *path" "uid_t owner" "gid_t group" .Sh DESCRIPTION The owner ID and group ID of the file named by @@ -69,12 +72,20 @@ on the file to prevent accidental or mischievous creation of set-user-id and set-group-id programs if not executed by the super-user. +.Fn chown +follows symbolic links to operate on the target of the link +rather than the link itself. .Pp .Fn Fchown is particularly useful when used in conjunction with the file locking primitives (see .Xr flock 2 ) . .Pp +.Fn Lchown +is similar to +.Fn chown +but does not follow symbolic links. +.Pp One of the owner or group id's may be left unchanged by specifying it as -1. .Sh RETURN VALUES @@ -84,6 +95,8 @@ error code being placed in the global variable .Va errno . .Sh ERRORS .Fn Chown +and +.Fn lchown will fail and the file will be unchanged if: .Bl -tag -width Er .It Bq Er ENOTDIR @@ -147,7 +160,10 @@ appeared in .Pp The .Fn chown -and -.Fn fchown -functions were changed to follow symbolic links in +functions was changed to follow symbolic links in .Bx 4.4 . +The +.Fn lchown +function was added in +.Fx 3.0 +to compensate for the loss of functionality.