Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorJohannes Sixt <johannes.sixt@telecom.at>2007-12-02 00:09:17 +0300
committerJohannes Sixt <johannes.sixt@telecom.at>2008-06-23 15:38:10 +0400
commitf7597acac069bbaad8887cb315a4e5420222971a (patch)
treeccdf641e80aafea570b1d3ad350a6911d73410ba /compat
parent3e4a1ba07b65506c36f7f40fa76fcee26c400a5c (diff)
Windows: A minimal implemention of getpwuid().
getpwuid() is implemented just enough that GIT does not issue errors. Since the information that it returns is not very useful, users are required to set up user.name and user.email configuration. All uses of getpwuid() are like getpwuid(getuid()), hence, the return value of getuid() is irrelevant and the uid parameter is not even looked at. Side note: getpwnam() is only used to resolve '~' and '~username' paths, which is an idiom not known on Windows, hence, we don't implement it. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Diffstat (limited to 'compat')
-rw-r--r--compat/mingw.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index f869999a5d..0e1ddbe4df 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -75,7 +75,15 @@ char *mingw_getcwd(char *pointer, int len)
struct passwd *getpwuid(int uid)
{
+ static char user_name[100];
static struct passwd p;
+
+ DWORD len = sizeof(user_name);
+ if (!GetUserName(user_name, &len))
+ return NULL;
+ p.pw_name = user_name;
+ p.pw_gecos = "unknown";
+ p.pw_dir = NULL;
return &p;
}