Author: wdoekes Date: Wed Aug 13 02:54:10 2014 New Revision: 420900 URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=420900 Log: logger: Don't store verbose-magic in the log files.
In r399267, the verbose2magic stuff was edited. This time it results in magic characters in the log files for multiline messages. In trunk (and 13) this was fixed by the "stripping" of those characters from multiline messages (in r414798). This fix is altered to actually strip the characters and not replace them with blanks. Review: https://reviewboard.asterisk.org/r/3901/ Review: https://reviewboard.asterisk.org/r/3902/ ........ Merged revisions 420897 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 420898 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 420899 from http://svn.asterisk.org/svn/asterisk/branches/13 Modified: trunk/ (props changed) trunk/main/logger.c Propchange: trunk/ ------------------------------------------------------------------------------ --- branch-13-merged (original) +++ branch-13-merged Wed Aug 13 02:54:10 2014 @@ -1,1 +1,1 @@ -/branches/13:1-420494,420514,420534,420536,420538,420562,420577,420592,420609,420624,420639,420657,420717,420742,420758,420779,420796,420803,420808,420837,420856,420879,420881 +/branches/13:1-420494,420514,420534,420536,420538,420562,420577,420592,420609,420624,420639,420657,420717,420742,420758,420779,420796,420803,420808,420837,420856,420879,420881,420899 Modified: trunk/main/logger.c URL: http://svnview.digium.com/svn/asterisk/trunk/main/logger.c?view=diff&rev=420900&r1=420899&r2=420900 ============================================================================== --- trunk/main/logger.c (original) +++ trunk/main/logger.c Wed Aug 13 02:54:10 2014 @@ -87,7 +87,7 @@ static void unique_callid_cleanup(void *data); struct ast_callid { - int call_identifier; /* Numerical value of the call displayed in the logs */ + int call_identifier; /* Numerical value of the call displayed in the logs */ }; AST_THREADSTORAGE_CUSTOM(unique_callid, NULL, unique_callid_cleanup); @@ -1179,20 +1179,28 @@ static char *logger_strip_verbose_magic(const char *message, int level) { - char *p; - char *stripped_message = ast_strdup(message); + const char *begin, *end; + char *stripped_message, *dst; char magic = -(level + 1); - if (!stripped_message) { + if (!(stripped_message = ast_malloc(strlen(message) + 1))) { return NULL; } + begin = message; + dst = stripped_message; do { - p = strchr(stripped_message, (char)magic); - if (p) { - *p++ = ' '; - } - } while (p && *p); + end = strchr(begin, magic); + if (end) { + size_t len = end - begin; + memcpy(dst, begin, len); + begin = end + 1; + dst += len; + } else { + strcpy(dst, begin); /* safe */ + break; + } + } while (1); return stripped_message; } -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- svn-commits mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/svn-commits