* acconfig.h, configure.in, locate_host.c, server.h: work around
authorNathan Bryant <loanshark@uncensored.citadel.org>
Thu, 25 Feb 1999 01:28:32 +0000 (01:28 +0000)
committerNathan Bryant <loanshark@uncensored.citadel.org>
Thu, 25 Feb 1999 01:28:32 +0000 (01:28 +0000)
          nonreentrant gethostbyaddr() on BSDI

citadel/ChangeLog
citadel/acconfig.h
citadel/configure.in
citadel/locate_host.c
citadel/server.h

index cd1eac629a50570aa121a6a31697532b9f980651..8072a43cb1d58ec7737cd11ba88124033d451ebf 100644 (file)
@@ -13,6 +13,8 @@
          don't call master_cleanup() directly from signal handler.
        * routines.c: prototype getutline() if necessary
        * getutline.c: stupid bugfix
+       * acconfig.h, configure.in, locate_host.c, server.h: work around
+         nonreentrant gethostbyaddr() on BSDI
 
 Mon Feb 15 22:59:00 EST 1999 Vaggelis Tsirkas
        * citadel.c: increased hostname buffer size to handle very big names
index 64357ff50ef1042261b67c37d363399addf62206..ae2811ffbc4395651c3f7a9fc934d0a06a851c4f 100644 (file)
@@ -6,3 +6,6 @@
 
 /* define this if struct utmp has an ut_type member */
 #undef HAVE_UT_TYPE
+
+/* define this if the OS has broken non-reentrant gethostby{name,addr}() */
+#undef HAVE_NONREENTRANT_NETDB
index 4ef211456ad491c1875fb0863acdf7848996bdd1..258bd3150fc705fa07e3430c229a8466ad8ce5c1 100644 (file)
@@ -19,10 +19,12 @@ AC_CANONICAL_HOST
 SO=.so
 case "$host" in
        dnl BSDI 3.0 wants relocatable object modules instead of shared libs
-       dnl for dlopen(), and has a wrapper script to link with shared libs
+       dnl for dlopen(), and has a wrapper script to link with shared libs.
+       dnl Also has stupid non-reentrant gethostbyaddr() and friends.
        i?86-*-bsdi*)
                test -z "$CC" -a -x /usr/bin/shlicc2 && CC=shlicc2
                SO=.mo
+               AC_DEFINE(HAVE_NONREENTRANT_NETDB)
        ;;
        dnl Digital Unix has an odd way to build pthreads, and we can't build
        dnl pthreads programs with gcc due to header problems.
index 9160c2d9a62b5e2f35d3ea9134ce9b23f047535a..85c4aa51031587b1deb5a10625e4ac56f4b25eec 100644 (file)
@@ -35,6 +35,10 @@ void locate_host(char *tbuf)
        strcpy(tbuf,config.c_fqdn);
        return;
        }
+
+#ifdef HAVE_NONREENTRANT_NETDB
+    begin_critical_section(S_NETDB);
+#endif
      
     if((ch = gethostbyaddr((char *) &cs.sin_addr, sizeof(cs.sin_addr),  
          AF_INET)) == NULL) { 
@@ -48,5 +52,10 @@ void locate_host(char *tbuf)
                }
 
        strncpy(tbuf,ch->h_name, 24);
+
+#ifdef HAVE_NONREENTRANT_NETDB
+       end_critical_section(S_NETDB);
+#endif
+
        tbuf[24] = 0;
        }
index 0f4067b70c5ebe5c91ad32e309b5f3a6ee45732a..9aaf56047edf08fb54061a92222a9eefe84a3a11 100644 (file)
@@ -119,7 +119,8 @@ struct ChatLine {
 #define S_CONTROL      8
 #define S_HOUSEKEEPING 9
 #define S_DATABASE     10
-#define MAX_SEMAPHORES 11
+#define S_NETDB                11
+#define MAX_SEMAPHORES 12
 
 
 /*