summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian2004-04-05 01:27:58 +0000
committerBruce Momjian2004-04-05 01:27:58 +0000
commit31f48c9afe4843b76a8f515dd32046214392ebae (patch)
tree592ac24e923c7470b7f1ad1301cb044ba99f2c05
parentd56b736db0ea4637ed76352ed8c0a01ba53994dd (diff)
Update thread test to only test for 'localhost' and local machine name.
-rw-r--r--src/tools/thread/thread_test.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/tools/thread/thread_test.c b/src/tools/thread/thread_test.c
index 3f4ad461aee..b8d26e98ce8 100644
--- a/src/tools/thread/thread_test.c
+++ b/src/tools/thread/thread_test.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/tools/thread/thread_test.c,v 1.10 2004/04/04 17:23:54 momjian Exp $
+ * $PostgreSQL: pgsql/src/tools/thread/thread_test.c,v 1.11 2004/04/05 01:27:58 momjian Exp $
*
* This program tests to see if your standard libc functions use
* pthread_setspecific()/pthread_getspecific() to be thread-safe.
@@ -35,6 +35,8 @@
void func_call_1(void);
void func_call_2(void);
+char myhostname[MAXHOSTNAMELEN];
+
int errno1_set = 0;
int errno2_set = 0;
@@ -61,6 +63,12 @@ int main(int argc, char *argv[])
return 1;
}
+ if (gethostname(myhostname, MAXHOSTNAMELEN) != 0)
+ {
+ fprintf(stderr, "can not get local hostname, exiting\n");
+ exit(1);
+ }
+
printf("\
Make sure you have added any needed 'THREAD_CPPFLAGS' and 'THREAD_LIBS'\n\
defines to your template/$port file before compiling this program.\n\n"
@@ -128,8 +136,9 @@ void func_call_1(void) {
passwd_p1 = NULL; /* force thread-safe failure report */
}
- hostent_p1 = gethostbyname("www.yahoo.com");
- p = gethostbyname("www.weather.com");
+ /* threads do this in opposite order */
+ hostent_p1 = gethostbyname(myhostname);
+ p = gethostbyname("localhost");
if (hostent_p1 != p)
{
printf("Your gethostbyname() changes the static memory area between calls\n");
@@ -174,8 +183,9 @@ void func_call_2(void) {
passwd_p2 = NULL; /* force thread-safe failure report */
}
- hostent_p2 = gethostbyname("www.google.com");
- p = gethostbyname("www.postgresql.org");
+ /* threads do this in opposite order */
+ hostent_p2 = gethostbyname("localhost");
+ p = gethostbyname(myhostname);
if (hostent_p2 != p)
{
printf("Your gethostbyname() changes the static memory area between calls\n");