]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/log.c
Merge pull request #4497 from opensourcerouting/rcu
[mirror_frr.git] / lib / log.c
index 399d1af0c4c73db4401ce185a9b97963698747c9..51a0ddd6b7c2454e5e2a5f3eec748b4cd602ee1f 100644 (file)
--- a/lib/log.c
+++ b/lib/log.c
@@ -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), ".");
                        }