diff options
author | Corey Farrell <git@cfware.com> | 2015-03-27 07:12:25 +0000 |
---|---|---|
committer | Corey Farrell <git@cfware.com> | 2015-03-27 07:12:25 +0000 |
commit | 28e3bd0af7d15f0b1e9dae5f0422ae0fe627b9cd (patch) | |
tree | b55a657449dd559453dc3fd7cab6f0f08a06c9de /main/strings.c | |
parent | 554eb7451638f8384f5150c3adc202194b5fafc0 (diff) |
Improved and portable ast_log recursion avoidance
This introduces a new logger routine ast_log_safe. This routine should be
used for all error messages in code that can be run as a result of ast_log.
ast_log_safe does nothing if run recursively. All error logging in
astobj2.c, strings.c and utils.h have been switched to ast_log_safe.
This required adding support for raw threadstorage. This provides direct
access to the void* pointer in threadstorage. In ast_log_safe, NULL is used
to signify that this thread is not already running ast_log_safe, (void*)1 when
it is already running. This was done since it's critical that ast_log_safe
do nothing that could log during recursion checking.
ASTERISK-24155 #close
Reported by: Timo Teräs
Review: https://reviewboard.asterisk.org/r/4502/
........
Merged revisions 433522 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 433523 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433524 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/strings.c')
-rw-r--r-- | main/strings.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/main/strings.c b/main/strings.c index 73892eb0a..b6b9fbcd7 100644 --- a/main/strings.c +++ b/main/strings.c @@ -87,9 +87,6 @@ int __ast_str_helper(struct ast_str **buf, ssize_t max_len, } else if (max_len == 0) { /* if unbounded, give more room for next time */ need += 16 + need / 4; } - if (0) { /* debugging */ - ast_verbose("extend from %d to %d\n", len, need); - } if ( #if (defined(MALLOC_DEBUG) && !defined(STANDALONE)) _ast_str_make_space(buf, need, file, lineno, function) @@ -97,7 +94,7 @@ int __ast_str_helper(struct ast_str **buf, ssize_t max_len, ast_str_make_space(buf, need) #endif ) { - ast_verbose("failed to extend from %d to %d\n", len, need); + ast_log_safe(LOG_VERBOSE, "failed to extend from %d to %d\n", len, need); va_end(aq); return AST_DYNSTR_BUILD_FAILED; } |