From: Tom Lane Date: Sun, 11 Jan 2015 17:52:37 +0000 (-0500) Subject: Remove configure test for nonstandard variants of getpwuid_r(). X-Git-Tag: REL9_5_ALPHA1~936 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8883bae33b55a52105b1b58d0e42c5a6bda09627;p=postgresql Remove configure test for nonstandard variants of getpwuid_r(). We had code that supposed that some platforms might offer a nonstandard version of getpwuid_r() with only four arguments. However, the 5-argument definition has been standardized at least since the Single Unix Spec v2, which is our normal reference for what's portable across all Unix-oid platforms. (What's more, this wasn't the only pre-standardization version of getpwuid_r(); my old HPUX 10.20 box has still another signature.) So let's just get rid of the now-useless configure step. --- diff --git a/config/c-library.m4 b/config/c-library.m4 index f40db6a1ee..933d95e8ef 100644 --- a/config/c-library.m4 +++ b/config/c-library.m4 @@ -79,30 +79,6 @@ AH_VERBATIM(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_cv_func_getpwuid_r_5arg, -[AC_TRY_COMPILE([#include -#include ], -[uid_t uid; -struct passwd *space; -char *buf; -size_t bufsize; -struct passwd **result; -getpwuid_r(uid, space, buf, bufsize, result);], -[pgac_cv_func_getpwuid_r_5arg=yes], -[pgac_cv_func_getpwuid_r_5arg=no])]) -if test x"$pgac_cv_func_getpwuid_r_5arg" = xyes ; then - AC_DEFINE(GETPWUID_R_5ARG, 1, - [Define to 1 if getpwuid_r() takes a 5th argument.]) -fi -])# PGAC_FUNC_GETPWUID_R_5ARG - - # PGAC_FUNC_STRERROR_R_INT # --------------------------- # Check if strerror_r() returns an int (SUSv3) rather than a char * (GNU libc) diff --git a/configure b/configure index fce49088a8..f32b38149a 100755 --- a/configure +++ b/configure @@ -12632,43 +12632,6 @@ done # Do test here with the proper thread flags -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getpwuid_r takes a fifth argument" >&5 -$as_echo_n "checking whether getpwuid_r takes a fifth argument... " >&6; } -if ${pgac_cv_func_getpwuid_r_5arg+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -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 -if ac_fn_c_try_compile "$LINENO"; then : - pgac_cv_func_getpwuid_r_5arg=yes -else - pgac_cv_func_getpwuid_r_5arg=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_func_getpwuid_r_5arg" >&5 -$as_echo "$pgac_cv_func_getpwuid_r_5arg" >&6; } -if test x"$pgac_cv_func_getpwuid_r_5arg" = xyes ; then - -$as_echo "#define GETPWUID_R_5ARG 1" >>confdefs.h - -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns int" >&5 $as_echo_n "checking whether strerror_r returns int... " >&6; } if ${pgac_cv_func_strerror_r_int+:} false; then : diff --git a/configure.in b/configure.in index 6aa69fb19f..56d1967eb4 100644 --- a/configure.in +++ b/configure.in @@ -1527,7 +1527,6 @@ fi AC_CHECK_FUNCS([strerror_r getpwuid_r gethostbyname_r]) # Do test here with the proper thread flags -PGAC_FUNC_GETPWUID_R_5ARG PGAC_FUNC_STRERROR_R_INT CFLAGS="$_CFLAGS" diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 83f04e9382..995fb65205 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -74,9 +74,6 @@ reference if 'false' */ #undef FLOAT8PASSBYVAL -/* Define to 1 if getpwuid_r() takes a 5th argument. */ -#undef GETPWUID_R_5ARG - /* Define to 1 if gettimeofday() takes only 1 argument. */ #undef GETTIMEOFDAY_1ARG diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index 05941e6577..69d0e31a07 100644 --- a/src/include/pg_config.h.win32 +++ b/src/include/pg_config.h.win32 @@ -62,9 +62,6 @@ (--enable-thread-safety) */ #define ENABLE_THREAD_SAFETY 1 -/* Define to 1 if getpwuid_r() takes a 5th argument. */ -/* #undef GETPWUID_R_5ARG */ - /* Define to 1 if gettimeofday() takes only 1 argument. */ /* #undef GETTIMEOFDAY_1ARG */ diff --git a/src/port/thread.c b/src/port/thread.c index aab74516ac..c1295cfc1f 100644 --- a/src/port/thread.c +++ b/src/port/thread.c @@ -82,7 +82,7 @@ pqStrerror(int errnum, char *strerrbuf, size_t buflen) /* * Wrapper around getpwuid() or getpwuid_r() to mimic POSIX getpwuid_r() - * behaviour, if it is not available or required. + * behaviour, if that function is not available or required. * * Per POSIX, the possible cases are: * success: returns zero, *result is non-NULL @@ -96,21 +96,7 @@ 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 */ return getpwuid_r(uid, resultbuf, buffer, buflen, result); -#else - - /* - * Early POSIX draft of getpwuid_r() returns 'struct passwd *'. - * getpwuid_r(uid, resultbuf, buffer, buflen) - */ - errno = 0; - *result = getpwuid_r(uid, resultbuf, buffer, buflen); - /* paranoia: ensure we return zero on success */ - return (*result == NULL) ? errno : 0; -#endif #else /* no getpwuid_r() available, just use getpwuid() */ errno = 0;