LOG: Gracefully fail when the caller exceeds QB_LOG_MAX_LEN

This commit is contained in:
Andrew Beekhof 2012-06-07 14:41:03 +10:00
parent 9b0bb4e80e
commit bb2e307241

View File

@ -96,6 +96,13 @@ _blackbox_vlogger(int32_t target,
/* log message */
msg_len = qb_vsprintf_serialize(chunk, cs->format, ap);
if(msg_len > QB_LOG_MAX_LEN) {
chunk = msg_len_pt + sizeof(uint32_t); /* Reset */
msg_len = qb_vsprintf_serialize(chunk, "Log message too long to be stored in the blackbox. Maximum is QB_LOG_MAX_LEN" , ap);
actual_size += msg_len;
}
actual_size += msg_len;
/* now that we know the length, write it