[Mono-bugs] [Bug 72818][Nor] Changed - getpwuid_r, getpwnam_r, getgrgid_r, getgrnam_r expects only 4 arguments
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 24 Feb 2005 12:21:56 -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 jonpryor@vt.edu.
http://bugzilla.ximian.com/show_bug.cgi?id=72818
--- shadow/72818 2005-02-23 10:13:25.000000000 -0500
+++ shadow/72818.tmp.8038 2005-02-24 12:21:56.000000000 -0500
@@ -1,12 +1,12 @@
Bug#: 72818
Product: Mono: Runtime
Version: 1.1
OS: Solaris [Other]
OS Details: Solaris 10 x86
-Status: NEEDINFO
+Status: REOPENED
Resolution:
Severity: Unknown
Priority: Normal
Component: io-layer
AssignedTo: mono-bugs@ximian.com
ReportedBy: jonel@road14.com
@@ -61,6 +61,36 @@
You mean that Solaris/SPARC and Solaris/x86 have different number of
arguments for those calls ?
Can you add the definition (from the .h) that Solaris/x86 requires ?
Thanks
+
+------- Additional Comments From jonpryor@vt.edu 2005-02-24 12:21 -------
+Solaris/SPARC has the 4-argument variant of these calls, so it's not a
+x86 vs sparc issue, it's Solaris vs Linux/POSIX.
+
+In short, while the POSIX variant has a pointer to a pointer as the
+5th argument and returns the error directly, Solaris returns the
+pointer and uses errno instead.
+
+Thus:
+
+ struct group *gbufp;
+ int r = getgrnam_r (name, gbuf, buf, buflen, &gbufp);
+ if (r == 0) { /* success */ }
+ else
+ errno = r;
+
+Would become
+
+ struct group *gbufp
+ gbufp = getgrnam_r (name, gbuf, buf, buflen);
+ if (gbufp != NULL) { /* success */ }
+ else
+ errno = errno;
+
+This pattern seems to be consistent for all of these functions.
+
+The bigger question is determining which variant to call. I have an
+idea for a configure.in-based check using AC_TRY_COMPILE; I will
+attach that.