diff options
Diffstat (limited to 'lib/log.c')
| -rw-r--r-- | lib/log.c | 17 |
1 files changed, 7 insertions, 10 deletions
@@ -387,10 +387,8 @@ void vzlog(int priority, const char *format, va_list args) /* If it doesn't match on a filter, do nothing with the debug log */ if ((priority == LOG_DEBUG) && zlog_filter_count - && vzlog_filter(zl, &tsctl, proto_str, priority, msg)) { - pthread_mutex_unlock(&loglock); + && vzlog_filter(zl, &tsctl, proto_str, priority, msg)) goto out; - } /* call external hook */ hook_call(zebra_ext_log, priority, format, args); @@ -1267,6 +1265,7 @@ void zlog_hexdump(const void *mem, unsigned int len) size_t bs = ((len / 8) + 1) * 53 + 1; char buf[bs]; char *s = buf; + const unsigned char *memch = mem; memset(buf, 0, sizeof(buf)); @@ -1275,12 +1274,11 @@ void zlog_hexdump(const void *mem, unsigned int len) /* print offset */ if (i % columns == 0) s += snprintf(s, bs - (s - buf), - "0x%016lx: ", (unsigned long)mem + i); + "0x%016lx: ", (unsigned long)memch + i); /* print hex data */ if (i < len) - s += snprintf(s, bs - (s - buf), "%02x ", - 0xFF & ((const char *)mem)[i]); + s += snprintf(s, bs - (s - buf), "%02x ", memch[i]); /* end of block, just aligning for ASCII dump */ else @@ -1292,10 +1290,9 @@ void zlog_hexdump(const void *mem, unsigned int len) /* end of block not really printing */ if (j >= len) s += snprintf(s, bs - (s - buf), " "); - else if (isprint((int)((const char *)mem)[j])) - s += snprintf( - s, bs - (s - buf), "%c", - 0xFF & ((const char *)mem)[j]); + else if (isprint(memch[j])) + s += snprintf(s, bs - (s - buf), "%c", + memch[j]); else /* other char */ s += snprintf(s, bs - (s - buf), "."); } |
