diff options
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r-- | winsup/cygwin/syscalls.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 657a40cfc..8c2b96b7b 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1943,14 +1943,18 @@ seteuid32 (__uid32_t uid) debug_printf ("uid: %d myself->gid: %d", uid, myself->gid); if (!wincap.has_security () - || (uid == myself->uid - && !cygheap->user.groups.ischanged) - || uid == ILLEGAL_UID) + || (uid == myself->uid && !cygheap->user.groups.ischanged)) { debug_printf ("Nothing happens"); return 0; } + if (uid == ILLEGAL_UID) + { + set_errno (EINVAL); + return -1; + } + sigframe thisframe (mainthread); cygsid usersid; user_groups &groups = cygheap->user.groups; @@ -2122,11 +2126,15 @@ setuid (__uid16_t uid) extern "C" int setegid32 (__gid32_t gid) { - if ((!wincap.has_security ()) || - (gid == myself->gid) || - (gid == ILLEGAL_GID)) + if (!wincap.has_security () || gid == myself->gid) return 0; + if (gid == ILLEGAL_GID) + { + set_errno (EINVAL); + return -1; + } + sigframe thisframe (mainthread); user_groups * groups = &cygheap->user.groups; cygsid gsid; |