projects
/
mono.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
2005-09-14 Geoff Norton <gnorton@customerdna.com>
[mono.git]
/
support
/
pwd.c
diff --git
a/support/pwd.c
b/support/pwd.c
index 6fa91dcee4c8bbae616aa50dd5f07fc9c6076f00..809934777e252d920333a2f0350326cb7af9a0cb 100644
(file)
--- a/
support/pwd.c
+++ b/
support/pwd.c
@@
-119,7
+119,7
@@
Mono_Posix_Syscall_getpwuid (mph_uid_t uid, struct Mono_Posix_Syscall__Passwd *p
gint32
Mono_Posix_Syscall_getpwnam_r (const char *name,
struct Mono_Posix_Syscall__Passwd *pwbuf,
gint32
Mono_Posix_Syscall_getpwnam_r (const char *name,
struct Mono_Posix_Syscall__Passwd *pwbuf,
-
struct passw
d **pwbufp)
+
voi
d **pwbufp)
{
char *buf, *buf2;
size_t buflen;
{
char *buf, *buf2;
size_t buflen;
@@
-143,9
+143,13
@@
Mono_Posix_Syscall_getpwnam_r (const char *name,
}
buf = buf2;
errno = 0;
}
buf = buf2;
errno = 0;
- } while ((r = getpwnam_r (name, &_pwbuf, buf, buflen, pwbufp)) &&
+ } while ((r = getpwnam_r (name, &_pwbuf, buf, buflen,
(struct passwd**)
pwbufp)) &&
recheck_range (r));
recheck_range (r));
+ if (r == 0 && !(*pwbufp))
+ /* On solaris, this function returns 0 even if the entry was not found */
+ r = errno = ENOENT;
+
if (r == 0 && copy_passwd (pwbuf, &_pwbuf) == -1)
r = errno = ENOMEM;
free (buf);
if (r == 0 && copy_passwd (pwbuf, &_pwbuf) == -1)
r = errno = ENOMEM;
free (buf);
@@
-158,7
+162,7
@@
Mono_Posix_Syscall_getpwnam_r (const char *name,
gint32
Mono_Posix_Syscall_getpwuid_r (mph_uid_t uid,
struct Mono_Posix_Syscall__Passwd *pwbuf,
gint32
Mono_Posix_Syscall_getpwuid_r (mph_uid_t uid,
struct Mono_Posix_Syscall__Passwd *pwbuf,
-
struct passw
d **pwbufp)
+
voi
d **pwbufp)
{
char *buf, *buf2;
size_t buflen;
{
char *buf, *buf2;
size_t buflen;
@@
-182,7
+186,7
@@
Mono_Posix_Syscall_getpwuid_r (mph_uid_t uid,
}
buf = buf2;
errno = 0;
}
buf = buf2;
errno = 0;
- } while ((r = getpwuid_r (uid, &_pwbuf, buf, buflen, pwbufp)) &&
+ } while ((r = getpwuid_r (uid, &_pwbuf, buf, buflen,
(struct passwd**)
pwbufp)) &&
recheck_range (r));
if (r == 0 && copy_passwd (pwbuf, &_pwbuf) == -1)
recheck_range (r));
if (r == 0 && copy_passwd (pwbuf, &_pwbuf) == -1)
@@
-217,7
+221,7
@@
Mono_Posix_Syscall_getpwent (struct Mono_Posix_Syscall__Passwd *pwbuf)
#ifdef HAVE_FGETPWENT
gint32
#ifdef HAVE_FGETPWENT
gint32
-Mono_Posix_Syscall_fgetpwent (
FILE
*stream, struct Mono_Posix_Syscall__Passwd *pwbuf)
+Mono_Posix_Syscall_fgetpwent (
void
*stream, struct Mono_Posix_Syscall__Passwd *pwbuf)
{
struct passwd *pw;
{
struct passwd *pw;
@@
-227,7
+231,7
@@
Mono_Posix_Syscall_fgetpwent (FILE *stream, struct Mono_Posix_Syscall__Passwd *p
}
errno = 0;
}
errno = 0;
- pw = fgetpwent (stream);
+ pw = fgetpwent (
(FILE*)
stream);
if (pw == NULL)
return -1;
if (pw == NULL)
return -1;