setresgid.c 718 B

123456789101112131415161718192021222324252627
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * setresgid() for uClibc
  4. *
  5. * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
  6. *
  7. * GNU Library General Public License (LGPL) version 2 or later.
  8. */
  9. #include "syscalls.h"
  10. #ifdef __NR_setresgid
  11. #define __NR___syscall_setresgid __NR_setresgid
  12. static inline _syscall3(int, __syscall_setresgid,
  13. __kernel_gid_t, rgid, __kernel_gid_t, egid, __kernel_gid_t, sgid);
  14. int setresgid(gid_t rgid, gid_t egid, gid_t sgid)
  15. {
  16. if (((rgid + 1) > (gid_t) ((__kernel_gid_t) - 1U))
  17. || ((egid + 1) > (gid_t) ((__kernel_gid_t) - 1U))
  18. || ((sgid + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
  19. __set_errno(EINVAL);
  20. return -1;
  21. }
  22. return (__syscall_setresgid(rgid, egid, sgid));
  23. }
  24. #endif