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

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2002-05-29 19:04:29 +0400
committerCorinna Vinschen <corinna@vinschen.de>2002-05-29 19:04:29 +0400
commita8d7ae61e7b832d354731b1d024e4ff1ed22fca0 (patch)
tree177816378230c384a5d6b375fc5e5b42478e06c2 /winsup/cygwin/passwd.cc
parent9854c44c43a179a550c2fb4d23a7f97332628ed3 (diff)
Change internal uid datatype from __uid16_t to __uid32_t
throughout. * cygwin.din: Export new symbols getpwuid32, getpwuid_r32, getuid32, geteuid32, setuid32, seteuid32. * passwd.cc (getpwuid32): New function. (getpwuid_r32): Ditto. * syscalls.cc (seteuid32): Ditto. (setuid32): Ditto. * uinfo.cc (getuid32): Ditto. (geteuid32): Ditto. * winsup.h (uid16touid32): New macro, correclt casting from __uid16_t to __uid32_t. (gid16togid32): Ditto fir gids. (getuid32): Declare. (geteuid32): Ditto. (getpwuid32): Ditto. * include/sys/cygwin.h (struct external_pinfo): Add members uid32 and gid32.
Diffstat (limited to 'winsup/cygwin/passwd.cc')
-rw-r--r--winsup/cygwin/passwd.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc
index 744fcd652..c526dd293 100644
--- a/winsup/cygwin/passwd.cc
+++ b/winsup/cygwin/passwd.cc
@@ -186,7 +186,7 @@ read_etc_passwd ()
/* Cygwin internal */
/* If this ever becomes non-reentrant, update all the getpw*_r functions */
static struct passwd *
-search_for (__uid16_t uid, const char *name)
+search_for (__uid32_t uid, const char *name)
{
struct passwd *res = 0;
struct passwd *default_pw = 0;
@@ -202,7 +202,7 @@ search_for (__uid16_t uid, const char *name)
if (strcasematch (name, res->pw_name))
return res;
}
- else if (uid == res->pw_uid)
+ else if (uid == (__uid32_t) res->pw_uid)
return res;
}
@@ -217,7 +217,7 @@ search_for (__uid16_t uid, const char *name)
}
extern "C" struct passwd *
-getpwuid (__uid16_t uid)
+getpwuid32 (__uid32_t uid)
{
if (passwd_state <= initializing)
read_etc_passwd ();
@@ -227,8 +227,14 @@ getpwuid (__uid16_t uid)
return search_for (uid, 0);
}
+extern "C" struct passwd *
+getpwuid (__uid16_t uid)
+{
+ return getpwuid32 (uid16touid32 (uid));
+}
+
extern "C" int
-getpwuid_r (__uid16_t uid, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result)
+getpwuid_r32 (__uid32_t uid, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result)
{
*result = NULL;
@@ -269,6 +275,12 @@ getpwuid_r (__uid16_t uid, struct passwd *pwd, char *buffer, size_t bufsize, str
return 0;
}
+extern "C" int
+getpwuid_r (__uid16_t uid, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result)
+{
+ return getpwuid_r32 (uid16touid32 (uid), pwd, buffer, bufsize, result);
+}
+
extern "C" struct passwd *
getpwnam (const char *name)
{