summaryrefslogtreecommitdiff
path: root/pjlib/src/pj/log.c
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-02-07 18:48:01 +0000
committerBenny Prijono <bennylp@teluu.com>2006-02-07 18:48:01 +0000
commit813cd5ef6791ddf9778ca61c08ce19f48202b3bc (patch)
tree4fcb5e984e0d06def8a8b1b3f4144bee31ac1ab6 /pjlib/src/pj/log.c
parentda1de0865a23a7eb5cde2b4160979164dbc08a39 (diff)
Tested initial implementation: basic UAC, client registration, authentication, etc
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@141 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pj/log.c')
-rw-r--r--pjlib/src/pj/log.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/pjlib/src/pj/log.c b/pjlib/src/pj/log.c
index 442ee942..066e765f 100644
--- a/pjlib/src/pj/log.c
+++ b/pjlib/src/pj/log.c
@@ -73,7 +73,7 @@ PJ_DEF(void) pj_log( const char *sender, int level,
#if PJ_LOG_USE_STACK_BUFFER
char log_buffer[PJ_LOG_MAX_SIZE];
#endif
- int len;
+ int len, print_len;
PJ_CHECK_STACK();
@@ -137,7 +137,12 @@ PJ_DEF(void) pj_log( const char *sender, int level,
len = pre - log_buffer;
/* Print the whole message to the string log_buffer. */
- len = len + vsnprintf(pre, sizeof(log_buffer)-len, format, marker);
+ print_len = vsnprintf(pre, sizeof(log_buffer)-len, format, marker);
+ if (print_len < 0) {
+ print_len = pj_snprintf(pre, sizeof(log_buffer)-len,
+ "<logging error: msg too long>");
+ }
+ len = len + print_len;
if (len > 0 && len < sizeof(log_buffer)-2) {
if (log_decor & PJ_LOG_HAS_CR) {
log_buffer[len++] = '\r';