fchown

Changes the user and group owner of the specified file.

Library:LibC
Classification:POSIX
Service:File and Directory I/O

Syntax

  #include <sys/stat.h> 
   
  int fchown (
     int     fildes,
     uid_t   owner,
     gid_t   group );
  

Parameters

fildes

(IN) Specifies the file descriptor of the file.

owner

(IN) Specifies the ID of the user to make the owner of the file.

group

(IN) Specifies the ID of the group to make the owner of the file.

Return Values

If successful, returns 0. Otherwise, returns -1 and sets errno to one of the following:

Decimal

Constant

Description

4

EBADF

The file descriptor is not valid.

69

EPERM

The caller does not have appropriate privileges.

105

ENOCONTEXT

The calling thread has no context.

Remarks

Setting a group owner has no effect on a NetWare file system.

See Also