There's no getlogin_t() on android.

This commit is contained in:
Bartosz Taudul 2018-08-27 13:59:19 +02:00
parent c0d140b405
commit 2ebe9b72d1

View File

@ -256,7 +256,19 @@ static const char* GetHostInfo()
char user[LOGIN_NAME_MAX]; char user[LOGIN_NAME_MAX];
gethostname( hostname, HOST_NAME_MAX ); gethostname( hostname, HOST_NAME_MAX );
# if defined __ANDROID__
const auto login = getlogin();
if( login )
{
strcpy( user, login );
}
else
{
memcpy( user, "(?)", 4 );
}
# else
getlogin_r( user, LOGIN_NAME_MAX ); getlogin_r( user, LOGIN_NAME_MAX );
# endif
ptr += sprintf( ptr, "User: %s@%s\n", user, hostname ); ptr += sprintf( ptr, "User: %s@%s\n", user, hostname );
#endif #endif