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

[tor-commits] [tor/master] Log version when LD_BUG is logged.



commit feca32903147e10974b00c80db56b1347e042946
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Wed Feb 25 10:29:52 2015 -0500

    Log version when LD_BUG is logged.
    
    Closes ticket 15026.
---
 changes/feature15026 |    5 +++++
 src/common/log.c     |   14 ++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/changes/feature15026 b/changes/feature15026
new file mode 100644
index 0000000..c732b41
--- /dev/null
+++ b/changes/feature15026
@@ -0,0 +1,5 @@
+  o Minor features (logging):
+    - Include the Tor version in all LD_BUG log messages, since people
+      tend to cut and paste those into the bugtracker. Implements
+      ticket 15026.
+
diff --git a/src/common/log.c b/src/common/log.c
index e8cc30c..396eb6b 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -263,6 +263,13 @@ log_tor_version(logfile_t *lf, int reset)
   return 0;
 }
 
+const char bug_suffix[] = " (on Tor " VERSION
+#ifndef _MSC_VER
+  " "
+#include "micro-revision.i"
+#endif
+  ")";
+
 /** Helper: Format a log message into a fixed-sized buffer. (This is
  * factored out of <b>logv</b> so that we never format a message more
  * than once.)  Return a pointer to the first character of the message
@@ -341,6 +348,13 @@ format_msg(char *buf, size_t buf_len,
       }
     }
   }
+
+  if (domain == LD_BUG &&
+      buf_len - n > strlen(bug_suffix)+1) {
+    memcpy(buf+n, bug_suffix, strlen(bug_suffix));
+    n += strlen(bug_suffix);
+  }
+
   buf[n]='\n';
   buf[n+1]='\0';
   *msg_len_out = n+1;

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