diff options
Diffstat (limited to 'src/port/thread.c')
-rw-r--r-- | src/port/thread.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/port/thread.c b/src/port/thread.c index d5bd47df4bb..96610f9f5a0 100644 --- a/src/port/thread.c +++ b/src/port/thread.c @@ -7,7 +7,7 @@ * * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/port/thread.c,v 1.24 2004/08/29 04:13:12 momjian Exp $ + * $PostgreSQL: pgsql/src/port/thread.c,v 1.25 2004/08/29 05:07:02 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -36,12 +36,12 @@ * Additional confusion exists because many operating systems that * use pthread_setspecific/pthread_getspecific() also have *_r versions * of standard library functions for compatibility with operating systems - * that require them. However, internally, these *_r functions merely + * that require them. However, internally, these *_r functions merely * call the thread-safe standard library functions. * * For example, BSD/OS 4.3 uses Bind 8.2.3 for getpwuid(). Internally, * getpwuid() calls pthread_setspecific/pthread_getspecific() to return - * static data to the caller in a thread-safe manner. However, BSD/OS + * static data to the caller in a thread-safe manner. However, BSD/OS * also has getpwuid_r(), which merely calls getpwuid() and shifts * around the arguments to match the getpwuid_r() function declaration. * Therefore, while BSD/OS has getpwuid_r(), it isn't required. It also @@ -59,7 +59,7 @@ * Run src/tools/thread to see if your operating system has thread-safe * non-*_r functions. */ - + /* * Wrapper around strerror and strerror_r to use the former if it is @@ -94,8 +94,8 @@ pqStrerror(int errnum, char *strerrbuf, size_t buflen) */ #ifndef WIN32 int -pqGetpwuid(uid_t uid, struct passwd *resultbuf, char *buffer, - size_t buflen, struct passwd **result) +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) @@ -103,9 +103,10 @@ pqGetpwuid(uid_t uid, struct passwd *resultbuf, char *buffer, /* 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) + * getpwuid_r(uid, resultbuf, buffer, buflen) */ *result = getpwuid_r(uid, resultbuf, buffer, buflen); #endif @@ -127,12 +128,13 @@ pqGetpwuid(uid_t uid, struct passwd *resultbuf, char *buffer, #ifndef HAVE_GETADDRINFO int pqGethostbyname(const char *name, - struct hostent *resultbuf, + struct hostent * resultbuf, char *buffer, size_t buflen, - struct hostent **result, + struct hostent ** result, int *herrno) { #if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(HAVE_GETHOSTBYNAME_R) + /* * broken (well early POSIX draft) gethostbyname_r() which returns * 'struct hostent *' @@ -147,11 +149,12 @@ pqGethostbyname(const char *name, if (*result != NULL) *herrno = h_errno; - + if (*result != NULL) return 0; else return -1; #endif } + #endif |