-const char jcc_rcs[] = "$Id: jcc.c,v 1.109 2006/12/06 19:41:40 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.113 2006/12/26 17:38:50 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.c,v $
*
* Revisions :
* $Log: jcc.c,v $
+ * Revision 1.113 2006/12/26 17:38:50 fabiankeil
+ * Silence compiler warning I introduced with my last commit.
+ *
+ * Revision 1.112 2006/12/26 17:31:41 fabiankeil
+ * Mutex protect rand() if POSIX threading
+ * is used, warn the user if that's not possible
+ * and stop using it on _WIN32 where it could
+ * cause crashes.
+ *
+ * Revision 1.111 2006/12/23 16:15:06 fabiankeil
+ * Don't prevent core dumps by catching SIGABRT.
+ * It's rude and makes debugging unreasonable painful.
+ *
+ * Revision 1.110 2006/12/13 14:52:53 etresoft
+ * Fix build failure on MacOS X. Global symbols can be either static or extern, but not both.
+ *
* Revision 1.109 2006/12/06 19:41:40 fabiankeil
* Privoxy is now able to run as intercepting
* proxy in combination with any packet filter
#ifndef HAVE_GETHOSTBYNAME_R
pthread_mutex_t gethostbyname_mutex;
#endif /* ndef HAVE_GETHOSTBYNAME_R */
+
+#ifndef HAVE_RANDOM
+pthread_mutex_t rand_mutex;
+#endif /* ndef HAVE_RANDOM */
+
#endif /* FEATURE_PTHREAD */
#if defined(unix) || defined(__EMX__)
* Function : sig_handler
*
* Description : Signal handler for different signals.
- * Exit gracefully on ABRT, TERM and INT
+ * Exit gracefully on TERM and INT
* or set a flag that will cause the errlog
* to be reopened by the main thread on HUP.
*
{
switch(the_signal)
{
- case SIGABRT:
case SIGTERM:
case SIGINT:
log_error(LOG_LEVEL_INFO, "exiting by signal %d .. bye", the_signal);
#endif
{
int argc_pos = 0;
-#ifdef HAVE_RANDOM
unsigned int random_seed;
-#endif /* ifdef HAVE_RANDOM */
#ifdef unix
struct passwd *pw = NULL;
struct group *grp = NULL;
#ifndef HAVE_GETHOSTBYNAME_R
pthread_mutex_init(&gethostbyname_mutex,0);
#endif /* ndef HAVE_GETHOSTBYNAME_R */
+
+#ifndef HAVE_RANDOM
+ pthread_mutex_init(&rand_mutex,0);
+#endif /* ndef HAVE_RANDOM */
+
#endif /* FEATURE_PTHREAD */
+ random_seed = (int)time(NULL);
#ifdef HAVE_RANDOM
- random_seed = (unsigned int)time(NULL);
srandom(random_seed);
+#else
+ srand(random_seed);
#endif /* ifdef HAVE_RANDOM */
/*
#if !defined(_WIN32) && !defined(__OS2__) && !defined(AMIGA)
{
int idx;
- const int catched_signals[] = { SIGABRT, SIGTERM, SIGINT, SIGHUP, 0 };
+ const int catched_signals[] = { SIGTERM, SIGINT, SIGHUP, 0 };
const int ignored_signals[] = { SIGPIPE, 0 };
for (idx = 0; catched_signals[idx] != 0; idx++)
pthread_attr_init(&attrs);
pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED);
errno = pthread_create(&the_thread, &attrs,
- (void*)serve, csp);
+ (void * (*)(void *))serve, csp);
child_id = errno ? -1 : 0;
pthread_attr_destroy(&attrs);
}