4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-03-04 05:55:38 +08:00

Cygwin: create_token: Return NULL, not INVALID_HANDLE_VALUE

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2019-01-25 19:58:21 +01:00
parent 3a1ed0ef70
commit 0e3fd33321
2 changed files with 5 additions and 5 deletions

View File

@ -907,8 +907,8 @@ create_token (cygsid &usersid, user_groups &new_groups)
source.SourceIdentifier.HighPart = 0; source.SourceIdentifier.HighPart = 0;
source.SourceIdentifier.LowPart = 0x0101; source.SourceIdentifier.LowPart = 0x0101;
HANDLE token = INVALID_HANDLE_VALUE; HANDLE token = NULL;
HANDLE primary_token = INVALID_HANDLE_VALUE; HANDLE primary_token = NULL;
tmp_pathbuf tp; tmp_pathbuf tp;
PTOKEN_GROUPS my_tok_gsids = NULL; PTOKEN_GROUPS my_tok_gsids = NULL;
@ -1010,6 +1010,7 @@ create_token (cygsid &usersid, user_groups &new_groups)
{ {
__seterrno (); __seterrno ();
debug_printf ("DuplicateTokenEx %E"); debug_printf ("DuplicateTokenEx %E");
primary_token = NULL;
} }
} }

View File

@ -3546,10 +3546,9 @@ seteuid32 (uid_t uid)
if (!(new_token = lsaauth (usersid, groups))) if (!(new_token = lsaauth (usersid, groups)))
{ {
debug_printf ("lsaauth failed, try create_token."); debug_printf ("lsaauth failed, try create_token.");
new_token = create_token (usersid, groups); if (!(new_token = create_token (usersid, groups)))
if (new_token == INVALID_HANDLE_VALUE)
{ {
debug_printf ("create_token failed, bail out of here"); debug_printf ("create_token failed, bail out");
cygheap->user.reimpersonate (); cygheap->user.reimpersonate ();
return -1; return -1;
} }