Fix return of getlogin()
This commit is contained in:
parent
51f378308f
commit
1e779f92ec
@ -221,7 +221,12 @@ BOOL GetUserNameExA(EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, PULONG
|
||||
if (getlogin_r(lpNameBuffer, *nSize) != 0)
|
||||
return FALSE;
|
||||
#else
|
||||
strncpy(lpNameBuffer, getlogin(), *nSize);
|
||||
{
|
||||
const char* name = getlogin();
|
||||
if (!name)
|
||||
return FALSE;
|
||||
strncpy(lpNameBuffer, name, strnlen(name, *nSize));
|
||||
}
|
||||
#endif
|
||||
*nSize = strnlen(lpNameBuffer, *nSize);
|
||||
return TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user