Wrapping all *_r functions (the non-_r versions of them) with mutex semaphores for...
[privoxy.git] / jcc.c
diff --git a/jcc.c b/jcc.c
index cb81afe..8628084 100644 (file)
--- a/jcc.c
+++ b/jcc.c
@@ -1,4 +1,4 @@
-const char jcc_rcs[] = "$Id: jcc.c,v 1.92.2.2 2002/11/20 14:37:47 oes Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.92.2.3 2003/02/28 12:53:06 oes Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/Attic/jcc.c,v $
@@ -33,6 +33,9 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.92.2.2 2002/11/20 14:37:47 oes Exp $";
  *
  * Revisions   :
  *    $Log: jcc.c,v $
+ *    Revision 1.92.2.3  2003/02/28 12:53:06  oes
+ *    Fixed two mostly harmless mem leaks
+ *
  *    Revision 1.92.2.2  2002/11/20 14:37:47  oes
  *    Fix: Head of global clients list now initialized to NULL
  *
@@ -667,6 +670,16 @@ static int32 server_thread(void *data);
 #define sleep(N)  DosSleep(((N) * 100))
 #endif
 
+#ifdef OSX_DARWIN
+/*
+ * Hit OSX over the head with a hammer.  Protect all *_r functions.
+ */
+pthread_mutex_t gmtime_mutex;
+pthread_mutex_t localtime_mutex;
+pthread_mutex_t gethostbyaddr_mutex;
+pthread_mutex_t gethostbyname_mutex;
+#endif /* def OSX_DARWIN */
+
 #if defined(unix) || defined(__EMX__)
 const char *basedir;
 const char *pidfile = NULL;
@@ -1846,6 +1859,16 @@ int main(int argc, const char *argv[])
    InitWin32();
 #endif
 
+#ifdef OSX_DARWIN
+   /*
+    * Prepare global mutex semaphores
+    */
+   pthread_mutex_init(&gmtime_mutex,0);
+   pthread_mutex_init(&localtime_mutex,0);
+   pthread_mutex_init(&gethostbyaddr_mutex,0);
+   pthread_mutex_init(&gethostbyname_mutex,0);
+#endif /* def OSX_DARWIN */
+
    /*
     * Unix signal handling
     *