Handle draft version of getpwuid_r() that accepts only four arguments.
Backpatch to 7.4.X. Required for Solaris 7 & 8.
This commit is contained in:
parent
6c7e6d2baa
commit
aaf54d99f0
@ -1,5 +1,5 @@
|
|||||||
# Macros that test various C library quirks
|
# Macros that test various C library quirks
|
||||||
# $PostgreSQL: pgsql/config/c-library.m4,v 1.24 2003/11/29 19:51:17 pgsql Exp $
|
# $PostgreSQL: pgsql/config/c-library.m4,v 1.25 2004/03/20 15:39:27 momjian Exp $
|
||||||
|
|
||||||
|
|
||||||
# PGAC_VAR_INT_TIMEZONE
|
# PGAC_VAR_INT_TIMEZONE
|
||||||
@ -73,6 +73,29 @@ AH_VERBATIM(GETTIMEOFDAY_1ARG_,
|
|||||||
])# PGAC_FUNC_GETTIMEOFDAY_1ARG
|
])# PGAC_FUNC_GETTIMEOFDAY_1ARG
|
||||||
|
|
||||||
|
|
||||||
|
# PGAC_FUNC_GETPWUID_R_5ARG
|
||||||
|
# ---------------------------
|
||||||
|
# Check if getpwuid_r() takes a fifth argument (later POSIX standard, not draft version)
|
||||||
|
# If so, define GETPWUID_R_5ARG
|
||||||
|
AC_DEFUN([PGAC_FUNC_GETPWUID_R_5ARG],
|
||||||
|
[AC_CACHE_CHECK(whether getpwuid_r takes a fifth argument,
|
||||||
|
pgac_func_getpwuid_r_5arg,
|
||||||
|
[AC_TRY_COMPILE([#include <sys/types.h>
|
||||||
|
#include <pwd.h>],
|
||||||
|
[uid_t uid;
|
||||||
|
struct passwd *space;
|
||||||
|
char *buf;
|
||||||
|
size_t bufsize;
|
||||||
|
struct passwd **result;
|
||||||
|
getpwuid_r(uid, space, buf, bufsize, result);],
|
||||||
|
[pgac_func_getpwuid_r_5arg=yes],
|
||||||
|
[pgac_func_getpwuid_r_5arg=no])])
|
||||||
|
if test x"$pgac_func_getpwuid_r_5arg" = xyes ; then
|
||||||
|
AC_DEFINE(GETPWUID_R_5ARG,, [Define to 1 if getpwuid_r() takes a 5th argument.])
|
||||||
|
fi
|
||||||
|
])# PGAC_FUNC_GETPWUID_R_5ARG
|
||||||
|
|
||||||
|
|
||||||
# PGAC_UNION_SEMUN
|
# PGAC_UNION_SEMUN
|
||||||
# ----------------
|
# ----------------
|
||||||
# Check if `union semun' exists. Define HAVE_UNION_SEMUN if so.
|
# Check if `union semun' exists. Define HAVE_UNION_SEMUN if so.
|
||||||
|
59
configure
vendored
59
configure
vendored
@ -13247,6 +13247,65 @@ cat >>confdefs.h <<\_ACEOF
|
|||||||
#define GETPWUID_THREADSAFE 1
|
#define GETPWUID_THREADSAFE 1
|
||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
|
else echo "$as_me:$LINENO: checking whether getpwuid_r takes a fifth argument" >&5
|
||||||
|
echo $ECHO_N "checking whether getpwuid_r takes a fifth argument... $ECHO_C" >&6
|
||||||
|
if test "${pgac_func_getpwuid_r_5arg+set}" = set; then
|
||||||
|
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||||
|
else
|
||||||
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
|
#line $LINENO "configure"
|
||||||
|
#include "confdefs.h"
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <pwd.h>
|
||||||
|
#ifdef F77_DUMMY_MAIN
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int F77_DUMMY_MAIN() { return 1; }
|
||||||
|
#endif
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
uid_t uid;
|
||||||
|
struct passwd *space;
|
||||||
|
char *buf;
|
||||||
|
size_t bufsize;
|
||||||
|
struct passwd **result;
|
||||||
|
getpwuid_r(uid, space, buf, bufsize, result);
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
rm -f conftest.$ac_objext
|
||||||
|
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||||
|
(eval $ac_compile) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); } &&
|
||||||
|
{ ac_try='test -s conftest.$ac_objext'
|
||||||
|
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||||
|
(eval $ac_try) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); }; }; then
|
||||||
|
pgac_func_getpwuid_r_5arg=yes
|
||||||
|
else
|
||||||
|
echo "$as_me: failed program was:" >&5
|
||||||
|
cat conftest.$ac_ext >&5
|
||||||
|
pgac_func_getpwuid_r_5arg=no
|
||||||
|
fi
|
||||||
|
rm -f conftest.$ac_objext conftest.$ac_ext
|
||||||
|
fi
|
||||||
|
echo "$as_me:$LINENO: result: $pgac_func_getpwuid_r_5arg" >&5
|
||||||
|
echo "${ECHO_T}$pgac_func_getpwuid_r_5arg" >&6
|
||||||
|
if test x"$pgac_func_getpwuid_r_5arg" = xyes ; then
|
||||||
|
|
||||||
|
cat >>confdefs.h <<\_ACEOF
|
||||||
|
#define GETPWUID_R_5ARG
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
if test "$enable_thread_safety" = yes -a "$GETHOSTBYNAME_THREADSAFE" = yes ; then
|
if test "$enable_thread_safety" = yes -a "$GETHOSTBYNAME_THREADSAFE" = yes ; then
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
dnl $PostgreSQL: pgsql/configure.in,v 1.319 2004/03/09 22:40:10 momjian Exp $
|
dnl $PostgreSQL: pgsql/configure.in,v 1.320 2004/03/20 15:39:27 momjian Exp $
|
||||||
dnl
|
dnl
|
||||||
dnl Developers, please strive to achieve this order:
|
dnl Developers, please strive to achieve this order:
|
||||||
dnl
|
dnl
|
||||||
@ -999,6 +999,7 @@ AC_DEFINE(STRERROR_THREADSAFE, 1, [Define if strerror is not thread safe])
|
|||||||
fi
|
fi
|
||||||
if test "$enable_thread_safety" = yes -a "$GETPWUID_THREADSAFE" = yes ; then
|
if test "$enable_thread_safety" = yes -a "$GETPWUID_THREADSAFE" = yes ; then
|
||||||
AC_DEFINE(GETPWUID_THREADSAFE, 1, [Define if getpwuid is not thread safe])
|
AC_DEFINE(GETPWUID_THREADSAFE, 1, [Define if getpwuid is not thread safe])
|
||||||
|
else PGAC_FUNC_GETPWUID_R_5ARG
|
||||||
fi
|
fi
|
||||||
if test "$enable_thread_safety" = yes -a "$GETHOSTBYNAME_THREADSAFE" = yes ; then
|
if test "$enable_thread_safety" = yes -a "$GETHOSTBYNAME_THREADSAFE" = yes ; then
|
||||||
AC_DEFINE(GETHOSTBYNAME_THREADSAFE, 1, [Define if gethostbyname is not thread safe])
|
AC_DEFINE(GETHOSTBYNAME_THREADSAFE, 1, [Define if gethostbyname is not thread safe])
|
||||||
|
@ -46,6 +46,9 @@
|
|||||||
/* Define if gethostbyname is not thread safe */
|
/* Define if gethostbyname is not thread safe */
|
||||||
#undef GETHOSTBYNAME_THREADSAFE
|
#undef GETHOSTBYNAME_THREADSAFE
|
||||||
|
|
||||||
|
/* Define to 1 if getpwuid_r() takes a 5th argument. */
|
||||||
|
#undef GETPWUID_R_5ARG
|
||||||
|
|
||||||
/* Define if getpwuid is not thread safe */
|
/* Define if getpwuid is not thread safe */
|
||||||
#undef GETPWUID_THREADSAFE
|
#undef GETPWUID_THREADSAFE
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
* 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)
|
size_t buflen, struct passwd **result)
|
||||||
{
|
{
|
||||||
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(HAVE_GETPWUID_R)
|
#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 *'.
|
* Early POSIX draft of getpwuid_r() returns 'struct passwd *'.
|
||||||
* getpwuid_r(uid, resultbuf, buffer, buflen)
|
* getpwuid_r(uid, resultbuf, buffer, buflen)
|
||||||
* Do we need to support it? bjm 2003-08-14
|
|
||||||
*/
|
*/
|
||||||
/* POSIX version */
|
result = getpwuid_r(uid, resultbuf, buffer, buflen);
|
||||||
getpwuid_r(uid, resultbuf, buffer, buflen, result);
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user