Skip to content

Commit

Permalink
LOG: Gracefully fail when the caller exceeds QB_LOG_MAX_LEN
Browse files Browse the repository at this point in the history
  • Loading branch information
beekhof committed Jun 7, 2012
1 parent 9b0bb4e commit bb2e307
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/log_blackbox.c
Expand Up @@ -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
Expand Down

0 comments on commit bb2e307

Please sign in to comment.