aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-08-15 20:13:07 +0000
committerNick Mathewson <nickm@torproject.org>2004-08-15 20:13:07 +0000
commitebf2d275bf37935ce5efff4f205d11eeb400d8c2 (patch)
treec4b2cceb626dabfb0c692c8a889ff47d10912b4f /src
parent2728a2e971ba128d84c2710505404d79705fc9e1 (diff)
downloadtor-ebf2d275bf37935ce5efff4f205d11eeb400d8c2.tar
tor-ebf2d275bf37935ce5efff4f205d11eeb400d8c2.tar.gz
End truncated log entries with [truncated]
svn:r2235
Diffstat (limited to 'src')
-rw-r--r--src/common/log.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/common/log.c b/src/common/log.c
index aff313d8c..8d4bb74d3 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -22,6 +22,9 @@
#define snprintf _snprintf
#endif
+#define TRUNCATED_STR "\n[truncated]"
+#define TRUNCATED_STR_LEN 12
+
/** Information for a single logfile; only used in log.c */
typedef struct logfile_t {
struct logfile_t *next; /**< Next logfile_t in the linked list. */
@@ -116,8 +119,10 @@ static INLINE void format_msg(char *buf, size_t buf_len,
}
n += vsnprintf(buf+n,buf_len-n,format,ap);
- if(n > buf_len)
+ if(n > buf_len) {
n = buf_len-1;
+ strcpy(buf+n-TRUNCATED_STR_LEN, TRUNCATED_STR);
+ }
buf[n]='\n';
buf[n+1]='\0';
}