>>-fchown--fd--uid--gid----------------------------------------><
Function
fchown invokes the fchown callable service to change the
owner and group of a file or directory indicated
by a file descriptor. The file descriptor is specified by a number.
Parameters
- fd
- The file descriptor for a file or directory.
- uid
- The numeric UID for the new owner of the file or the present
UID, or -1 if there is no change.
- gid
- The numeric GID for the new group for the file or the present
GID, or -1 if there is no change.
Usage notes
- The fchown service changes the owner UID and owner GID of a file.
Only a superuser can change the owner UID of a file.
- The owner GID of a file can be changed by a superuser, or if a
caller meets all of these conditions:
- The effective UID of the caller matches the file's owner UID.
- The uid value specified in the change request matches
the file's owner UID.
- The gid value specified in the change request is the
effective GID, or one of the supplementary GIDs, of the caller.
- The set-user-ID-on-execution and set-group-ID-on-execution permissions
of the file mode are automatically turned off.
- If the change request is successful, the change time for the file
is updated.
- Values for both uid and gid must be specified
as they are to be set. If you want to change only one of these values,
the other must be set to its present value to remain unchanged.
Example
In the following example, assume that
fd,
uid,
and
gid were assigned a value earlier in the exec:
"fchown" fd uid gid