Go back to getpwuid call on OSX
Reading /etc/passwd on OSX does not give us the full list of users. Fixes #1758
This commit is contained in:
parent
2f9deaf067
commit
a33d18e125
|
@ -530,6 +530,9 @@ void RemoteUI::exit(int status)
|
||||||
|
|
||||||
String get_user_name(int uid)
|
String get_user_name(int uid)
|
||||||
{
|
{
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
return getpwuid(uid)->pw_name;
|
||||||
|
#else // Do not use getpwuid to avoid dependency on dynamic glibc
|
||||||
struct invalid_index : runtime_error
|
struct invalid_index : runtime_error
|
||||||
{
|
{
|
||||||
invalid_index(size_t i) : runtime_error{format("invalid index '{}'", i)} {}
|
invalid_index(size_t i) : runtime_error{format("invalid index '{}'", i)} {}
|
||||||
|
@ -543,6 +546,7 @@ String get_user_name(int uid)
|
||||||
return name_and_id[0].str();
|
return name_and_id[0].str();
|
||||||
}
|
}
|
||||||
throw runtime_error(format("Cannot find user name for uid '{}'", uid));
|
throw runtime_error(format("Cannot find user name for uid '{}'", uid));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static sockaddr_un session_addr(StringView session)
|
static sockaddr_un session_addr(StringView session)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user