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>
Johannes Sixt committed
Dec 1, 2007 at 22:09 UTC
f7597acac069bbaad8887cb315a4e5420222971a
1 file changed
+8
compat/mingw.c
+8
@@ -75,7 +75,15 @@ char *mingw_getcwd(char *pointer, int len)
75
76
struct passwd *getpwuid(int uid)
77
{
78
+ static char user_name[100];
79
static struct passwd p;
80
+
81
+ DWORD len = sizeof(user_name);
82
+ if (!GetUserName(user_name, &len))
83
+ return NULL;
84
+ p.pw_name = user_name;
85
+ p.pw_gecos = "unknown";
86
+ p.pw_dir = NULL;
87
return &p;
88
}
89