summaryrefslogtreecommitdiff
path: root/lib/libc/sys
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1997-05-03 11:22:34 +0000
committerPeter Wemm <peter@FreeBSD.org>1997-05-03 11:22:34 +0000
commitaf9d21a2858190fb036931fd9f7ae9b68166b43d (patch)
tree527bfa513be69b979c97f95941b801a3556b1be5 /lib/libc/sys
parentd3aa55124216a00bf0501411b46cc09cea3bfecf (diff)
Notes
Diffstat (limited to 'lib/libc/sys')
-rw-r--r--lib/libc/sys/Makefile.inc6
-rw-r--r--lib/libc/sys/chown.222
2 files changed, 23 insertions, 5 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index 324305a3b605..a334a3f8452f 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -1,5 +1,5 @@
# @(#)Makefile.inc 8.1 (Berkeley) 6/17/93
-# $Id: Makefile.inc,v 1.19 1996/05/28 16:24:53 phk Exp $
+# $Id: Makefile.inc,v 1.20 1996/09/20 13:55:25 phk 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 \
@@ -112,7 +112,7 @@ MLINKS+=dup.2 dup2.2
MLINKS+=chdir.2 fchdir.2
MLINKS+=chflags.2 fchflags.2
MLINKS+=chmod.2 fchmod.2
-MLINKS+=chown.2 fchown.2
+MLINKS+=chown.2 fchown.2 chown.2 lchown.2
MLINKS+=getgid.2 getegid.2
MLINKS+=getitimer.2 setitimer.2
MLINKS+=getlogin.2 setlogin.2
diff --git a/lib/libc/sys/chown.2 b/lib/libc/sys/chown.2
index 423224d8c89d..d4f0600e05ec 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: chown.2,v 1.4.2.3 1997/02/28 05:50:39 mpp Exp $
+.\" $Id: chown.2,v 1.4.2.4 1997/04/01 19:19:04 mpp 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 <unistd.h>
@@ -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
@@ -149,3 +162,8 @@ The
.Fn chown
function was changed to follow symbolic links in
.Bx 4.4 .
+The
+.Fn lchown
+function was added in
+.Fx 2.2
+to compensate for the loss of functionality.