Back to index

glibc  2.9
Functions
lchown.c File Reference
#include <errno.h>
#include <unistd.h>
#include <sysdep.h>
#include <sys/syscall.h>
#include <bp-checks.h>
#include <linux/posix_types.h>
#include <kernel-features.h>

Go to the source code of this file.

Functions

int __lchown (const char *file, uid_t owner, gid_t group)

Function Documentation

int __lchown ( const char *  file,
uid_t  owner,
gid_t  group 
)

Definition at line 38 of file lchown.c.

{
# if __ASSUME_32BITUIDS > 0
  return INLINE_SYSCALL (lchown32, 3, CHECK_STRING (file), owner, group);
# else
#  ifdef __NR_lchown32
  if (__libc_missing_32bit_uids <= 0)
    {
      int result;
      int saved_errno = errno;

      result = INLINE_SYSCALL (lchown32, 3, CHECK_STRING (file), owner, group);
      if (result == 0 || errno != ENOSYS)
       return result;

      __set_errno (saved_errno);
      __libc_missing_32bit_uids = 1;
    }
#  endif /* __NR_lchown32 */

  if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U))
      || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U)))
    {
      __set_errno (EINVAL);
      return -1;
    }

  return INLINE_SYSCALL (lchown, 3, CHECK_STRING (file), owner, group);
# endif
}