[UP]


Manual Reference Pages  - system_chown (3)

NAME

system_chown(3f) - [M_system] change file owner and group (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Return Value
Example

SYNOPSIS

elemental impure logical function system_chown(path,owner,group)

character(len=*),intent(in) :: path integer,intent(in) :: owner integer,intent(in) :: group

DESCRIPTION

The chown(3f) function changes owner and group of a file

The path argument points to a pathname naming a file. The user ID and group ID of the named file shall be set to the numeric values contained in owner and group, respectively.

Only processes with an effective user ID equal to the user ID of the file or with appropriate privileges may change the ownership of a file.

OPTIONS

path a character string representing a file pathname. Trailing spaces are ignored.
owner UID of owner that ownership is to be changed to
group GID of group that ownership is to be changed to

RETURN VALUE

The system_chown(3f) function should return zero 0 if successful. Otherwise, these functions shall return 1 and set errno to indicate the error. If 1 is returned, no changes are made in the user ID and group ID of the file.

EXAMPLE

Sample program:

   program demo_system_chown
   use M_system, only : system_chown
   use M_system, only : system_getuid
   use M_system, only : system_getgid
   use M_system, only : system_perror
   implicit none
   integer                     :: i
   character(len=80),parameter :: names(*)=[character(len=80) :: ’myfile1’,’/usr/local’]
   do i=1,size(names)
      if(.not.  system_chown(&
      & trim(names(i)),  &
      & system_getuid(), &
      & system_getgid()) &
         )then
         call system_perror(’*demo_system_chown* ’//trim(names(i)))
      endif
   enddo
   end program demo_system_chown


system_chown (3) July 05, 2020
Generated by manServer 1.08 from 7c68f4d6-2174-45b8-ba99-a143b2aeb4ef using man macros.