gint32
Mono_Posix_Syscall_getpwnam_r (const char *name,
struct Mono_Posix_Syscall__Passwd *pwbuf,
- struct passwd **pwbufp)
+ void **pwbufp)
{
char *buf, *buf2;
size_t buflen;
}
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));
+ 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);
gint32
Mono_Posix_Syscall_getpwuid_r (mph_uid_t uid,
struct Mono_Posix_Syscall__Passwd *pwbuf,
- struct passwd **pwbufp)
+ void **pwbufp)
{
char *buf, *buf2;
size_t buflen;
}
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)
#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;
}
errno = 0;
- pw = fgetpwent (stream);
+ pw = fgetpwent ((FILE*) stream);
if (pw == NULL)
return -1;