diff options
author | Steffen Kieß <s-kiess@web.de> | 2013-04-18 22:34:15 +0400 |
---|---|---|
committer | Zoltan Varga <vargaz@gmail.com> | 2013-04-18 22:35:30 +0400 |
commit | f7b355721ae3d90426fd9a77e698909edebdd188 (patch) | |
tree | 41c041879f1e1c02badc7ec5e6b8d12e72efc857 /support | |
parent | 78d9c2ce12f36a4ce94e7bbb23b823869d5b84e8 (diff) |
Fix a crash in Mono.Posix.Syscall.getpwuid_r () on some systems when a uid is not found. Fixes #11770.
Diffstat (limited to 'support')
-rw-r--r-- | support/pwd.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/support/pwd.c b/support/pwd.c index 4bb6ad6ca2b..6e3b68a208e 100644 --- a/support/pwd.c +++ b/support/pwd.c @@ -183,6 +183,10 @@ Mono_Posix_Syscall_getpwuid_r (mph_uid_t uid, } while ((r = getpwuid_r (uid, &_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); |