[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [torsocks/osx] Make a global variable less generic



commit 24794f78844ecc9978e6f78ace136c5f45154a16
Author: Robert Hogan <robert@xxxxxxxxxxxxxxx>
Date:   Sun Sep 19 13:39:18 2010 +0100

    Make a global variable less generic
    
    Exporting a global variable called 'progname' is not a good
    idea if you are a library. Exporting global variables at all
    is probably a bad idea.
    
    For now, make the name less generic - it was causing crashes
    when torsocks was used with dig.
    
    Part of the fix for:
        http://code.google.com/p/torsocks/issues/detail?id=15
---
 src/common.c       |    4 ++--
 src/inspectsocks.c |    2 +-
 src/tsocks.c       |    2 +-
 src/validateconf.c |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/common.c b/src/common.c
index 8a53bb0..2f7e233 100644
--- a/src/common.c
+++ b/src/common.c
@@ -182,7 +182,7 @@ int count_netmask_bits(uint32_t mask)
 void show_msg(int level, const char *fmt, ...) {
     va_list ap;
     int saveerr;
-    extern char *progname;
+    extern char *torsocks_progname;
     char timestring[20];
     time_t timestamp;
 
@@ -208,7 +208,7 @@ void show_msg(int level, const char *fmt, ...) {
         fprintf(logfile, "%s ", timestring);
     }
 
-    fputs(progname, logfile);
+    fputs(torsocks_progname, logfile);
 
     if (logstamp) {
         fprintf(logfile, "(%d)", getpid());
diff --git a/src/inspectsocks.c b/src/inspectsocks.c
index e780518..d93bddf 100644
--- a/src/inspectsocks.c
+++ b/src/inspectsocks.c
@@ -50,7 +50,7 @@
 */
 
 /* Global configuration variables */ 
-const char *progname = "inspectsocks";	   /* Name for error msgs      */
+const char *torsocks_progname = "inspectsocks";	   /* Name for error msgs      */
 int defaultport	= 1080;			   /* Default SOCKS port       */
 
 /* Header Files */
diff --git a/src/tsocks.c b/src/tsocks.c
index 3a9327a..ddaebf3 100644
--- a/src/tsocks.c
+++ b/src/tsocks.c
@@ -72,7 +72,7 @@ From 'man compat' in OSX:
 #endif
 
 /* Global configuration variables */
-const char *progname = "libtorsocks";         /* Name used in err msgs    */
+const char *torsocks_progname = "libtorsocks";         /* Name used in err msgs    */
 
 /* Header Files */
 #include <stdio.h>
diff --git a/src/validateconf.c b/src/validateconf.c
index 5c2acc5..6f92b55 100644
--- a/src/validateconf.c
+++ b/src/validateconf.c
@@ -50,7 +50,7 @@
 */
 
 /* Global configuration variables */ 
-const char *progname = "validateconf";	      /* Name for error msgs      */
+const char *torsocks_progname = "validateconf";	      /* Name for error msgs      */
 
 /* Header Files */
 #include <config.h>



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits