Fixed fallback to getlogin for android

This commit is contained in:
akallabeth 2020-06-02 14:41:37 +02:00 committed by Armin Novak
parent 308c2c3544
commit caff01877d
2 changed files with 8 additions and 0 deletions

View File

@ -600,8 +600,12 @@ static BOOL isAutomountLocation(const char* path)
uid_t uid = getuid();
char uname[MAX_PATH] = { 0 };
#ifndef getlogin_r
strncpy(uname, getlogin(), sizeof(uname));
#else
if (getlogin_r(uname, sizeof(uname)) != 0)
return FALSE;
#endif
if (!path)
return FALSE;

View File

@ -206,8 +206,12 @@ BOOL GetUserNameExA(EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, PULONG
switch (NameFormat)
{
case NameSamCompatible:
#ifndef getlogin_r
strncpy(login, getlogin(), sizeof(login));
#else
if (getlogin_r(login, sizeof(login)) != 0)
return FALSE;
#endif
length = strlen(login);
if (*nSize >= length)