diff options
author | Ron Yorston <rmy@pobox.com> | 2015-02-26 15:50:39 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2015-02-26 15:50:39 +0000 |
commit | 59abbf391be4ddaab0e0335b4f3691cc48590574 (patch) | |
tree | ceeea37fd680410c15689ce42e19ec62b7f5e69b /include/mingw.h | |
parent | 63dbf1908bc51918d9d963f4d9b7657306b2970d (diff) | |
download | busybox-w32-59abbf391be4ddaab0e0335b4f3691cc48590574.tar.gz busybox-w32-59abbf391be4ddaab0e0335b4f3691cc48590574.tar.bz2 busybox-w32-59abbf391be4ddaab0e0335b4f3691cc48590574.zip |
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.
Diffstat (limited to 'include/mingw.h')
-rw-r--r-- | include/mingw.h | 16 |
1 files changed, 10 insertions, 6 deletions
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; | |||
13 | typedef __int64 pid_t; | 13 | typedef __int64 pid_t; |
14 | #endif | 14 | #endif |
15 | 15 | ||
16 | #define DEFAULT_UID 1000 | ||
17 | #define DEFAULT_GID 1000 | ||
18 | |||
16 | /* | 19 | /* |
17 | * arpa/inet.h | 20 | * arpa/inet.h |
18 | */ | 21 | */ |
@@ -42,7 +45,7 @@ struct group { | |||
42 | char **gr_mem; | 45 | char **gr_mem; |
43 | }; | 46 | }; |
44 | IMPL(getgrnam,struct group *,NULL,const char *name UNUSED_PARAM); | 47 | IMPL(getgrnam,struct group *,NULL,const char *name UNUSED_PARAM); |
45 | IMPL(getgrgid,struct group *,NULL,gid_t gid UNUSED_PARAM); | 48 | struct group *getgrgid(gid_t gid); |
46 | NOIMPL(initgroups,const char *group UNUSED_PARAM,gid_t gid UNUSED_PARAM); | 49 | NOIMPL(initgroups,const char *group UNUSED_PARAM,gid_t gid UNUSED_PARAM); |
47 | static inline void endgrent(void) {} | 50 | static inline void endgrent(void) {} |
48 | 51 | ||
@@ -71,6 +74,7 @@ struct sockaddr_un { | |||
71 | */ | 74 | */ |
72 | struct passwd { | 75 | struct passwd { |
73 | char *pw_name; | 76 | char *pw_name; |
77 | char *pw_passwd; | ||
74 | char *pw_gecos; | 78 | char *pw_gecos; |
75 | char *pw_dir; | 79 | char *pw_dir; |
76 | char *pw_shell; | 80 | char *pw_shell; |
@@ -79,7 +83,7 @@ struct passwd { | |||
79 | }; | 83 | }; |
80 | 84 | ||
81 | IMPL(getpwnam,struct passwd *,NULL,const char *name UNUSED_PARAM); | 85 | IMPL(getpwnam,struct passwd *,NULL,const char *name UNUSED_PARAM); |
82 | struct passwd *getpwuid(int uid); | 86 | struct passwd *getpwuid(uid_t uid); |
83 | static inline void setpwent(void) {} | 87 | static inline void setpwent(void) {} |
84 | static inline void endpwent(void) {} | 88 | static inline void endpwent(void) {} |
85 | IMPL(getpwent_r,int,ENOENT,struct passwd *pwbuf UNUSED_PARAM,char *buf UNUSED_PARAM,size_t buflen UNUSED_PARAM,struct passwd **pwbufp UNUSED_PARAM); | 89 | 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); | |||
360 | char *mingw_getcwd(char *pointer, int len); | 364 | char *mingw_getcwd(char *pointer, int len); |
361 | 365 | ||
362 | 366 | ||
363 | IMPL(getgid,int,1,void); | 367 | IMPL(getgid,int,DEFAULT_GID,void); |
364 | NOIMPL(getgroups,int n UNUSED_PARAM,gid_t *groups UNUSED_PARAM); | 368 | NOIMPL(getgroups,int n UNUSED_PARAM,gid_t *groups UNUSED_PARAM); |
365 | IMPL(getppid,int,1,void); | 369 | IMPL(getppid,int,1,void); |
366 | IMPL(getegid,int,1,void); | 370 | IMPL(getegid,int,DEFAULT_GID,void); |
367 | IMPL(geteuid,int,1,void); | 371 | IMPL(geteuid,int,DEFAULT_UID,void); |
368 | NOIMPL(getsid,pid_t pid UNUSED_PARAM); | 372 | NOIMPL(getsid,pid_t pid UNUSED_PARAM); |
369 | IMPL(getuid,int,1,void); | 373 | IMPL(getuid,int,DEFAULT_UID,void); |
370 | int fcntl(int fd, int cmd, ...); | 374 | int fcntl(int fd, int cmd, ...); |
371 | #define fork() -1 | 375 | #define fork() -1 |
372 | IMPL(fsync,int,0,int fd UNUSED_PARAM); | 376 | IMPL(fsync,int,0,int fd UNUSED_PARAM); |