summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/chown.2
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-03-31 12:37:35 +0000
committerpeter <peter@FreeBSD.org>1997-03-31 12:37:35 +0000
commit3c380c1c4446013d1ef43b65cdaa901dbde82890 (patch)
tree64a573d44c9d9fa5d301507739309f775fbd98b1 /lib/libc/sys/chown.2
parentb95c5ce5786c8b14b3a68ddfb63837b22a905aa7 (diff)
downloadFreeBSD-src-3c380c1c4446013d1ef43b65cdaa901dbde82890.zip
FreeBSD-src-3c380c1c4446013d1ef43b65cdaa901dbde82890.tar.gz
Create lchown() in libc and document it as a variation of chown().
Diffstat (limited to 'lib/libc/sys/chown.2')
-rw-r--r--lib/libc/sys/chown.226
1 files changed, 21 insertions, 5 deletions
diff --git a/lib/libc/sys/chown.2 b/lib/libc/sys/chown.2
index 8cf5422..340d395 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 <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
@@ -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.
OpenPOWER on IntegriCloud