aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2004-03-20 15:39:27 +0000
committerBruce Momjian <bruce@momjian.us>2004-03-20 15:39:27 +0000
commitaaf54d99f0c2492a64118fa50e5b6dcfa8116e69 (patch)
tree211f3e3a422820f00bde2cda32bbc71abf595e24 /src
parent6c7e6d2baa509cb71f46b323191194a88745e7d3 (diff)
downloadpostgresql-aaf54d99f0c2492a64118fa50e5b6dcfa8116e69.tar.gz
postgresql-aaf54d99f0c2492a64118fa50e5b6dcfa8116e69.zip
Handle draft version of getpwuid_r() that accepts only four arguments.
Backpatch to 7.4.X. Required for Solaris 7 & 8.
Diffstat (limited to 'src')
-rw-r--r--src/include/pg_config.h.in3
-rw-r--r--src/port/thread.c12
2 files changed, 11 insertions, 4 deletions
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index 7fbfa66086e..a3101668a48 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -46,6 +46,9 @@
/* Define if gethostbyname is not thread safe */
#undef GETHOSTBYNAME_THREADSAFE
+/* Define to 1 if getpwuid_r() takes a 5th argument. */
+#undef GETPWUID_R_5ARG
+
/* Define if getpwuid is not thread safe */
#undef GETPWUID_THREADSAFE
diff --git a/src/port/thread.c b/src/port/thread.c
index db640c0ec29..a835f8778a2 100644
--- a/src/port/thread.c
+++ b/src/port/thread.c
@@ -7,7 +7,7 @@
*
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/port/thread.c,v 1.17 2004/03/14 14:01:43 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/thread.c,v 1.18 2004/03/20 15:39:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -97,13 +97,17 @@ pqGetpwuid(uid_t uid, struct passwd *resultbuf, char *buffer,
size_t buflen, struct passwd **result)
{
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(HAVE_GETPWUID_R)
+
+#ifdef GETPWUID_R_5ARG
+ /* POSIX version */
+ getpwuid_r(uid, resultbuf, buffer, buflen, result);
+#else
/*
* Early POSIX draft of getpwuid_r() returns 'struct passwd *'.
* getpwuid_r(uid, resultbuf, buffer, buflen)
- * Do we need to support it? bjm 2003-08-14
*/
- /* POSIX version */
- getpwuid_r(uid, resultbuf, buffer, buflen, result);
+ result = getpwuid_r(uid, resultbuf, buffer, buflen);
+#endif
#else