mirror of
https://github.com/neovim/neovim.git
synced 2025-09-23 03:28:33 +00:00
os_get_user_name() for non UNIX system #2729
os_get_user_name() requires getuid(), which is only available in UNIX. Return FAIL for non UNIX systems. On FAIL os_get_user_name() fills the buffer with the uid. In Windows libuv uses 0 for uid in stat structs, so 0 is used here too.
This commit is contained in:

committed by
Justin M. Keyes

parent
8f3eb69207
commit
2e1a80563b
@@ -41,7 +41,12 @@ int os_get_usernames(garray_T *users)
|
|||||||
// Return OK if a name found.
|
// Return OK if a name found.
|
||||||
int os_get_user_name(char *s, size_t len)
|
int os_get_user_name(char *s, size_t len)
|
||||||
{
|
{
|
||||||
|
#ifdef UNIX
|
||||||
return os_get_uname(getuid(), s, len);
|
return os_get_uname(getuid(), s, len);
|
||||||
|
#else
|
||||||
|
// TODO(equalsraf): Windows GetUserName()
|
||||||
|
return os_get_uname(0, s, len);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert user name for "uid" in s[len].
|
// Insert user name for "uid" in s[len].
|
||||||
|
Reference in New Issue
Block a user