[Mono-bugs] [Bug 72292][Wis] New - getpwent in libMonoPosixHelper fails on Solaris 8

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 7 Feb 2005 12:26:49 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by vargaz@gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=72292

--- shadow/72292	2005-02-07 12:26:49.000000000 -0500
+++ shadow/72292.tmp.17939	2005-02-07 12:26:49.000000000 -0500
@@ -0,0 +1,41 @@
+Bug#: 72292
+Product: Mono: Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: vargaz@gmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: getpwent in libMonoPosixHelper fails on Solaris 8
+
+On solaris 8, when getpwent returns NULL at the end of the enumeration, it
+sets errno to EBADF which causes the calling code to throw an exception.
+The following patch fixes this:
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+Index: pwd.c
+===================================================================
+--- pwd.c       (revision 40238)
++++ pwd.c       (working copy)
+@@ -201,8 +201,11 @@
+        }
+
+        pw = getpwent ();
+-       if (pw == NULL)
++       if (pw == NULL) {
++               /* solaris 8 sets errno to EBADF at the end of the
+enumeration */
++               errno = 0;
+                return -1;
++       }
+
+        if (copy_passwd (pwbuf, pw) == -1) {
+                errno = ENOMEM;
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<