[PATCH] add configure test for IRIX' getpwent_r and getpwent_r to fix the build

Björn Jacke bj at sernet.de
Thu Jan 10 13:33:21 GMT 2008


This patch adds configure tests for IRIX' getpwent_r and getpwent_r and
modification of nss_wrapper to fix the build.

Metze, can you have a look please?

Björn

---
 source/lib/nss_wrapper/nss_wrapper.c |    4 ++--
 source/lib/replace/system/config.m4  |   24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/source/lib/nss_wrapper/nss_wrapper.c b/source/lib/nss_wrapper/nss_wrapper.c
index 5d443fa..f0bc806 100644
--- a/source/lib/nss_wrapper/nss_wrapper.c
+++ b/source/lib/nss_wrapper/nss_wrapper.c
@@ -906,7 +906,7 @@ _PUBLIC_ int nwrap_getpwent_r(struct passwd *pwdst, char *buf,
 	struct passwd *pw;
 
 	if (!nwrap_enabled()) {
-#ifdef SOLARIS_GETPWENT_R
+#if defined(SOLARIS_GETPWENT_R) || defined(IRIX_GETPWENT_R)
 		pw = real_getpwent_r(pwdst, buf, buflen);
 		if (!pw) {
 			if (errno == 0) {
@@ -1092,7 +1092,7 @@ _PUBLIC_ int nwrap_getgrent_r(struct group *grdst, char *buf,
 	struct group *gr;
 
 	if (!nwrap_enabled()) {
-#ifdef SOLARIS_GETGRENT_R
+#if defined(SOLARIS_GETGRENT_R) || defined(IRIX_GETGRENT_R)
 		gr = real_getgrent_r(grdst, buf, buflen);
 		if (!gr) {
 			if (errno == 0) {
diff --git a/source/lib/replace/system/config.m4 b/source/lib/replace/system/config.m4
index 799187a..f26b9c9 100644
--- a/source/lib/replace/system/config.m4
+++ b/source/lib/replace/system/config.m4
@@ -73,6 +73,18 @@ AC_VERIFY_C_PROTOTYPE([struct passwd *getpwent_r(struct passwd *src, char *buf,
 	#include <unistd.h>
 	#include <pwd.h>
 	])
+AC_VERIFY_C_PROTOTYPE([struct passwd *getpwent_r(struct passwd *src, char *buf, size_t buflen)],
+	[
+	#ifndef HAVE_GETPWENT_R_DECL
+	#error missing getpwent_r prototype
+	#endif
+	return NULL;
+	],[
+	AC_DEFINE(SOLARIS_GETPWENT_R, 1, [getpwent_r irix function prototype])
+	],[],[
+	#include <unistd.h>
+	#include <pwd.h>
+	])
 AC_CHECK_FUNCS(getgrnam_r getgrgid_r getgrent_r)
 AC_HAVE_DECL(getgrent_r, [
 	#include <unistd.h>
@@ -90,6 +102,18 @@ AC_VERIFY_C_PROTOTYPE([struct group *getgrent_r(struct group *src, char *buf, in
 	#include <unistd.h>
 	#include <grp.h>
 	])
+AC_VERIFY_C_PROTOTYPE([struct group *getgrent_r(struct group *src, char *buf, size_t buflen)],
+	[
+	#ifndef HAVE_GETGRENT_R_DECL
+	#error missing getgrent_r prototype
+	#endif
+	return NULL;
+	],[
+	AC_DEFINE(IRIX_GETGRENT_R, 1, [getgrent_r irix function prototype])
+	],[],[
+	#include <unistd.h>
+	#include <grp.h>
+	])
 
 # locale
 AC_CHECK_HEADERS(ctype.h locale.h)
-- 
1.5.3.6



More information about the samba-technical mailing list