From 59abbf391be4ddaab0e0335b4f3691cc48590574 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Thu, 26 Feb 2015 15:50:39 +0000 Subject: Make uid/gid handling more consistent Various fake POSIX routines returned different values for uid/gid: getuid/getgid used 1, stat used 0 and getpwuid used 1000. Standardise on 1000. Also, add fake getgrgid. --- include/mingw.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'include/mingw.h') diff --git a/include/mingw.h b/include/mingw.h index 090dd1776..970b689fd 100644 --- a/include/mingw.h +++ b/include/mingw.h @@ -13,6 +13,9 @@ typedef int pid_t; typedef __int64 pid_t; #endif +#define DEFAULT_UID 1000 +#define DEFAULT_GID 1000 + /* * arpa/inet.h */ @@ -42,7 +45,7 @@ struct group { char **gr_mem; }; IMPL(getgrnam,struct group *,NULL,const char *name UNUSED_PARAM); -IMPL(getgrgid,struct group *,NULL,gid_t gid UNUSED_PARAM); +struct group *getgrgid(gid_t gid); NOIMPL(initgroups,const char *group UNUSED_PARAM,gid_t gid UNUSED_PARAM); static inline void endgrent(void) {} @@ -71,6 +74,7 @@ struct sockaddr_un { */ struct passwd { char *pw_name; + char *pw_passwd; char *pw_gecos; char *pw_dir; char *pw_shell; @@ -79,7 +83,7 @@ struct passwd { }; IMPL(getpwnam,struct passwd *,NULL,const char *name UNUSED_PARAM); -struct passwd *getpwuid(int uid); +struct passwd *getpwuid(uid_t uid); static inline void setpwent(void) {} static inline void endpwent(void) {} IMPL(getpwent_r,int,ENOENT,struct passwd *pwbuf UNUSED_PARAM,char *buf UNUSED_PARAM,size_t buflen UNUSED_PARAM,struct passwd **pwbufp UNUSED_PARAM); @@ -360,13 +364,13 @@ int mingw_dup2 (int fd, int fdto); char *mingw_getcwd(char *pointer, int len); -IMPL(getgid,int,1,void); +IMPL(getgid,int,DEFAULT_GID,void); NOIMPL(getgroups,int n UNUSED_PARAM,gid_t *groups UNUSED_PARAM); IMPL(getppid,int,1,void); -IMPL(getegid,int,1,void); -IMPL(geteuid,int,1,void); +IMPL(getegid,int,DEFAULT_GID,void); +IMPL(geteuid,int,DEFAULT_UID,void); NOIMPL(getsid,pid_t pid UNUSED_PARAM); -IMPL(getuid,int,1,void); +IMPL(getuid,int,DEFAULT_UID,void); int fcntl(int fd, int cmd, ...); #define fork() -1 IMPL(fsync,int,0,int fd UNUSED_PARAM); -- cgit v1.2.3-55-g6feb