Now that init_log_module() is called earlier, call show_version()
authorFabian Keil <fk@fabiankeil.de>
Mon, 9 Feb 2009 21:21:16 +0000 (21:21 +0000)
committerFabian Keil <fk@fabiankeil.de>
Mon, 9 Feb 2009 21:21:16 +0000 (21:21 +0000)
later on from main() directly so it doesn't get called for --help
or --version.

errlog.c
errlog.h
jcc.c

index 6178d4b..138d7e9 100644 (file)
--- a/errlog.c
+++ b/errlog.c
@@ -1,4 +1,4 @@
-const char errlog_rcs[] = "$Id: errlog.c,v 1.84 2008/12/14 15:46:22 fabiankeil Exp $";
+const char errlog_rcs[] = "$Id: errlog.c,v 1.85 2009/02/06 17:51:38 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/errlog.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/errlog.c,v $
@@ -6,7 +6,7 @@ const char errlog_rcs[] = "$Id: errlog.c,v 1.84 2008/12/14 15:46:22 fabiankeil E
  * Purpose     :  Log errors to a designated destination in an elegant,
  *                printf-like fashion.
  *
  * Purpose     :  Log errors to a designated destination in an elegant,
  *                printf-like fashion.
  *
- * Copyright   :  Written by and Copyright (C) 2001-2008 the SourceForge
+ * Copyright   :  Written by and Copyright (C) 2001-2009 the SourceForge
  *                Privoxy team. http://www.privoxy.org/
  *
  *                Based on the Internet Junkbuster originally written
  *                Privoxy team. http://www.privoxy.org/
  *
  *                Based on the Internet Junkbuster originally written
@@ -33,6 +33,9 @@ const char errlog_rcs[] = "$Id: errlog.c,v 1.84 2008/12/14 15:46:22 fabiankeil E
  *
  * Revisions   :
  *    $Log: errlog.c,v $
  *
  * Revisions   :
  *    $Log: errlog.c,v $
+ *    Revision 1.85  2009/02/06 17:51:38  fabiankeil
+ *    Be prepared if I break the log module initialization again.
+ *
  *    Revision 1.84  2008/12/14 15:46:22  fabiankeil
  *    Give crunched requests their own log level.
  *
  *    Revision 1.84  2008/12/14 15:46:22  fabiankeil
  *    Give crunched requests their own log level.
  *
@@ -552,7 +555,7 @@ static void fatal_error(const char * error_message)
  * Returns     :  Nothing.
  *
  *********************************************************************/
  * Returns     :  Nothing.
  *
  *********************************************************************/
-static void show_version(const char *prog_name)
+void show_version(const char *prog_name)
 {
    log_error(LOG_LEVEL_INFO, "Privoxy version " VERSION);
    if (prog_name != NULL)
 {
    log_error(LOG_LEVEL_INFO, "Privoxy version " VERSION);
    if (prog_name != NULL)
@@ -576,13 +579,12 @@ static void show_version(const char *prog_name)
  * Returns     :  Nothing.
  *
  *********************************************************************/
  * Returns     :  Nothing.
  *
  *********************************************************************/
-void init_log_module(const char *prog_name)
+void init_log_module(void)
 {
    lock_logfile();
    logfp = stderr;
    unlock_logfile();
    set_debug_level(debug);
 {
    lock_logfile();
    logfp = stderr;
    unlock_logfile();
    set_debug_level(debug);
-   show_version(prog_name);
 }
 
 
 }
 
 
@@ -714,7 +716,7 @@ void init_error_log(const char *prog_name, const char *logfname)
    /*
     * Prevent the Windows GUI from showing the version two
     * times in a row on startup. It already displayed the show_version()
    /*
     * Prevent the Windows GUI from showing the version two
     * times in a row on startup. It already displayed the show_version()
-    * call from init_log_module() that other systems write to stderr.
+    * call from main() that other systems write to stderr.
     *
     * This means mingw32 users will never see the version in their
     * log file, but I assume they wouldn't look for it there anyway
     *
     * This means mingw32 users will never see the version in their
     * log file, but I assume they wouldn't look for it there anyway
index 950f52d..e322020 100644 (file)
--- a/errlog.h
+++ b/errlog.h
@@ -1,6 +1,6 @@
 #ifndef ERRLOG_H_INCLUDED
 #define ERRLOG_H_INCLUDED
 #ifndef ERRLOG_H_INCLUDED
 #define ERRLOG_H_INCLUDED
-#define ERRLOG_H_VERSION "$Id: errlog.h,v 1.20 2008/03/27 18:27:23 fabiankeil Exp $"
+#define ERRLOG_H_VERSION "$Id: errlog.h,v 1.21 2008/12/14 15:46:22 fabiankeil Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/errlog.h,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/errlog.h,v $
@@ -8,7 +8,7 @@
  * Purpose     :  Log errors to a designated destination in an elegant,
  *                printf-like fashion.
  *
  * Purpose     :  Log errors to a designated destination in an elegant,
  *                printf-like fashion.
  *
- * Copyright   :  Written by and Copyright (C) 2001-2007 the SourceForge
+ * Copyright   :  Written by and Copyright (C) 2001-2009 the SourceForge
  *                Privoxy team. http://www.privoxy.org/
  *
  *                Based on the Internet Junkbuster originally written
  *                Privoxy team. http://www.privoxy.org/
  *
  *                Based on the Internet Junkbuster originally written
@@ -35,6 +35,9 @@
  *
  * Revisions   :
  *    $Log: errlog.h,v $
  *
  * Revisions   :
  *    $Log: errlog.h,v $
+ *    Revision 1.21  2008/12/14 15:46:22  fabiankeil
+ *    Give crunched requests their own log level.
+ *
  *    Revision 1.20  2008/03/27 18:27:23  fabiankeil
  *    Remove kill-popups action.
  *
  *    Revision 1.20  2008/03/27 18:27:23  fabiankeil
  *    Remove kill-popups action.
  *
@@ -183,8 +186,9 @@ extern "C" {
 
 extern void init_error_log(const char *prog_name, const char *logfname);
 extern void set_debug_level(int debuglevel);
 
 extern void init_error_log(const char *prog_name, const char *logfname);
 extern void set_debug_level(int debuglevel);
-void disable_logging(void);
-void init_log_module(const char *prog_name);
+extern void disable_logging(void);
+extern void init_log_module(void);
+extern void show_version(const char *prog_name);
 extern void log_error(int loglevel, const char *fmt, ...);
 extern const char *jb_err_to_string(int error);
 
 extern void log_error(int loglevel, const char *fmt, ...);
 extern const char *jb_err_to_string(int error);
 
diff --git a/jcc.c b/jcc.c
index 9c4ee5b..320d28f 100644 (file)
--- a/jcc.c
+++ b/jcc.c
@@ -1,4 +1,4 @@
-const char jcc_rcs[] = "$Id: jcc.c,v 1.221 2009/02/06 18:02:58 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.222 2009/02/08 12:56:51 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
@@ -6,7 +6,7 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.221 2009/02/06 18:02:58 fabiankeil Exp $"
  * Purpose     :  Main file.  Contains main() method, main loop, and
  *                the main connection-handling function.
  *
  * Purpose     :  Main file.  Contains main() method, main loop, and
  *                the main connection-handling function.
  *
- * Copyright   :  Written by and Copyright (C) 2001-2008 the SourceForge
+ * Copyright   :  Written by and Copyright (C) 2001-2009 the SourceForge
  *                Privoxy team. http://www.privoxy.org/
  *
  *                Based on the Internet Junkbuster originally written
  *                Privoxy team. http://www.privoxy.org/
  *
  *                Based on the Internet Junkbuster originally written
@@ -33,6 +33,10 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.221 2009/02/06 18:02:58 fabiankeil Exp $"
  *
  * Revisions   :
  *    $Log: jcc.c,v $
  *
  * Revisions   :
  *    $Log: jcc.c,v $
+ *    Revision 1.222  2009/02/08 12:56:51  fabiankeil
+ *    Call initialize_mutexes() before init_log_module() again.
+ *    Broken since r220, might be the cause of Lee's #2579448.
+ *
  *    Revision 1.221  2009/02/06 18:02:58  fabiankeil
  *    When dropping privileges, also give up membership in supplementary
  *    groups. Thanks to Matthias Drochner for reporting the problem,
  *    Revision 1.221  2009/02/06 18:02:58  fabiankeil
  *    When dropping privileges, also give up membership in supplementary
  *    groups. Thanks to Matthias Drochner for reporting the problem,
@@ -3580,7 +3584,7 @@ int main(int argc, const char *argv[])
    initialize_mutexes();
 
    /* Enable logging until further notice. */
    initialize_mutexes();
 
    /* Enable logging until further notice. */
-   init_log_module(Argv[0]);
+   init_log_module();
 
    /*
     * Parse the command line arguments
 
    /*
     * Parse the command line arguments
@@ -3693,6 +3697,8 @@ int main(int argc, const char *argv[])
 
    } /* -END- while (more arguments) */
 
 
    } /* -END- while (more arguments) */
 
+   show_version(Argv[0]);
+
 #if defined(unix)
    if ( *configfile != '/' )
    {
 #if defined(unix)
    if ( *configfile != '/' )
    {