aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRui Abreu Ferreira <raf-ep@gmx.com>2015-05-14 09:38:25 +0100
committerJustin M. Keyes <justinkz@gmail.com>2015-08-04 19:15:17 -0400
commit2e1a80563b56ecfee0306bf724b264115ca751a1 (patch)
tree9ecbf6cfe6eae1bd64327321c695f65d0cd105c3
parent8f3eb69207b7135d66cd44f0ac50100367bc78b4 (diff)
downloadrneovim-2e1a80563b56ecfee0306bf724b264115ca751a1.tar.gz
rneovim-2e1a80563b56ecfee0306bf724b264115ca751a1.tar.bz2
rneovim-2e1a80563b56ecfee0306bf724b264115ca751a1.zip
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.
-rw-r--r--src/nvim/os/users.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nvim/os/users.c b/src/nvim/os/users.c
index a57ba41af1..637a86c74f 100644
--- a/src/nvim/os/users.c
+++ b/src/nvim/os/users.c
@@ -41,7 +41,12 @@ int os_get_usernames(garray_T *users)
// Return OK if a name found.
int os_get_user_name(char *s, size_t len)
{
+#ifdef UNIX
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].