Permalink
Browse files

Fix a crash in Mono.Posix.Syscall.getpwuid_r () on some systems when …

…a uid is not found. Fixes #11770.
  • Loading branch information...
1 parent 78d9c2c commit f7b355721ae3d90426fd9a77e698909edebdd188 @steffen-kiess steffen-kiess committed with vargaz Apr 18, 2013
Showing with 4 additions and 0 deletions.
  1. +4 −0 support/pwd.c
View
@@ -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);

0 comments on commit f7b3557

Please sign in to comment.