Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaaf54d9

Browse files
committed
Handle draft version of getpwuid_r() that accepts only four arguments.
Backpatch to 7.4.X. Required for Solaris 7 & 8.
1 parent6c7e6d2 commitaaf54d9

File tree

5 files changed

+96
-6
lines changed

5 files changed

+96
-6
lines changed

‎config/c-library.m4

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Macros that test various C library quirks
2-
# $PostgreSQL: pgsql/config/c-library.m4,v 1.24 2003/11/29 19:51:17 pgsql Exp $
2+
# $PostgreSQL: pgsql/config/c-library.m4,v 1.25 2004/03/20 15:39:27 momjian Exp $
33

44

55
# PGAC_VAR_INT_TIMEZONE
@@ -73,6 +73,29 @@ AH_VERBATIM(GETTIMEOFDAY_1ARG_,
7373
])# PGAC_FUNC_GETTIMEOFDAY_1ARG
7474

7575

76+
# PGAC_FUNC_GETPWUID_R_5ARG
77+
# ---------------------------
78+
# Check if getpwuid_r() takes a fifth argument (later POSIX standard, not draft version)
79+
# If so, define GETPWUID_R_5ARG
80+
AC_DEFUN([PGAC_FUNC_GETPWUID_R_5ARG],
81+
[AC_CACHE_CHECK(whethergetpwuid_rtakesafifthargument,
82+
pgac_func_getpwuid_r_5arg,
83+
[AC_TRY_COMPILE([#include <sys/types.h>
84+
#include <pwd.h>],
85+
[uid_t uid;
86+
struct passwd *space;
87+
char *buf;
88+
size_t bufsize;
89+
struct passwd **result;
90+
getpwuid_r(uid, space, buf, bufsize, result);],
91+
[pgac_func_getpwuid_r_5arg=yes],
92+
[pgac_func_getpwuid_r_5arg=no])])
93+
if test x"$pgac_func_getpwuid_r_5arg" = xyes ; then
94+
AC_DEFINE(GETPWUID_R_5ARG,,[Define to 1 if getpwuid_r() takes a 5th argument.])
95+
fi
96+
])# PGAC_FUNC_GETPWUID_R_5ARG
97+
98+
7699
# PGAC_UNION_SEMUN
77100
# ----------------
78101
# Check if `union semun' exists. Define HAVE_UNION_SEMUN if so.

‎configure

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13247,6 +13247,65 @@ cat >>confdefs.h <<\_ACEOF
1324713247
#define GETPWUID_THREADSAFE 1
1324813248
_ACEOF
1324913249

13250+
elseecho "$as_me:$LINENO: checking whether getpwuid_r takes a fifth argument" >&5
13251+
echo $ECHO_N "checking whether getpwuid_r takes a fifth argument... $ECHO_C" >&6
13252+
if test "${pgac_func_getpwuid_r_5arg+set}" = set; then
13253+
echo $ECHO_N "(cached) $ECHO_C" >&6
13254+
else
13255+
cat >conftest.$ac_ext <<_ACEOF
13256+
#line $LINENO "configure"
13257+
#include "confdefs.h"
13258+
#include <sys/types.h>
13259+
#include <pwd.h>
13260+
#ifdef F77_DUMMY_MAIN
13261+
# ifdef __cplusplus
13262+
extern "C"
13263+
# endif
13264+
int F77_DUMMY_MAIN() { return 1; }
13265+
#endif
13266+
int
13267+
main ()
13268+
{
13269+
uid_t uid;
13270+
struct passwd *space;
13271+
char *buf;
13272+
size_t bufsize;
13273+
struct passwd **result;
13274+
getpwuid_r(uid, space, buf, bufsize, result);
13275+
;
13276+
return 0;
13277+
}
13278+
_ACEOF
13279+
rm -f conftest.$ac_objext
13280+
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
13281+
(eval $ac_compile) 2>&5
13282+
ac_status=$?
13283+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
13284+
(exit $ac_status); } &&
13285+
{ ac_try='test -s conftest.$ac_objext'
13286+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
13287+
(eval $ac_try) 2>&5
13288+
ac_status=$?
13289+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
13290+
(exit $ac_status); }; }; then
13291+
pgac_func_getpwuid_r_5arg=yes
13292+
else
13293+
echo "$as_me: failed program was:" >&5
13294+
cat conftest.$ac_ext >&5
13295+
pgac_func_getpwuid_r_5arg=no
13296+
fi
13297+
rm -f conftest.$ac_objext conftest.$ac_ext
13298+
fi
13299+
echo "$as_me:$LINENO: result: $pgac_func_getpwuid_r_5arg" >&5
13300+
echo "${ECHO_T}$pgac_func_getpwuid_r_5arg" >&6
13301+
if test x"$pgac_func_getpwuid_r_5arg" = xyes ; then
13302+
13303+
cat >>confdefs.h <<\_ACEOF
13304+
#define GETPWUID_R_5ARG
13305+
_ACEOF
13306+
13307+
fi
13308+
1325013309
fi
1325113310
if test "$enable_thread_safety" = yes -a "$GETHOSTBYNAME_THREADSAFE" = yes ; then
1325213311

‎configure.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.319 2004/03/09 22:40:10 momjian Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.320 2004/03/20 15:39:27 momjian Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -999,6 +999,7 @@ AC_DEFINE(STRERROR_THREADSAFE, 1, [Define if strerror is not thread safe])
999999
fi
10001000
if test "$enable_thread_safety" = yes -a "$GETPWUID_THREADSAFE" = yes ; then
10011001
AC_DEFINE(GETPWUID_THREADSAFE, 1, [Define if getpwuid is not thread safe])
1002+
elsePGAC_FUNC_GETPWUID_R_5ARG
10021003
fi
10031004
if test "$enable_thread_safety" = yes -a "$GETHOSTBYNAME_THREADSAFE" = yes ; then
10041005
AC_DEFINE(GETHOSTBYNAME_THREADSAFE, 1, [Define if gethostbyname is not thread safe])

‎src/include/pg_config.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
/* Define if gethostbyname is not thread safe */
4747
#undef GETHOSTBYNAME_THREADSAFE
4848

49+
/* Define to 1 if getpwuid_r() takes a 5th argument. */
50+
#undef GETPWUID_R_5ARG
51+
4952
/* Define if getpwuid is not thread safe */
5053
#undef GETPWUID_THREADSAFE
5154

‎src/port/thread.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
99
*
10-
* $PostgreSQL: pgsql/src/port/thread.c,v 1.17 2004/03/14 14:01:43 momjian Exp $
10+
* $PostgreSQL: pgsql/src/port/thread.c,v 1.18 2004/03/20 15:39:27 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -97,13 +97,17 @@ pqGetpwuid(uid_t uid, struct passwd *resultbuf, char *buffer,
9797
size_tbuflen,structpasswd**result)
9898
{
9999
#if defined(FRONTEND)&& defined(ENABLE_THREAD_SAFETY)&& defined(HAVE_GETPWUID_R)
100+
101+
#ifdefGETPWUID_R_5ARG
102+
/* POSIX version */
103+
getpwuid_r(uid,resultbuf,buffer,buflen,result);
104+
#else
100105
/*
101106
* Early POSIX draft of getpwuid_r() returns 'struct passwd *'.
102107
* getpwuid_r(uid, resultbuf, buffer, buflen)
103-
* Do we need to support it? bjm 2003-08-14
104108
*/
105-
/* POSIX version */
106-
getpwuid_r(uid,resultbuf,buffer,buflen,result);
109+
result=getpwuid_r(uid,resultbuf,buffer,buflen);
110+
#endif
107111

108112
#else
109113

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp