summaryrefslogtreecommitdiff
path: root/lib/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/log.c')
-rw-r--r--lib/log.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/lib/log.c b/lib/log.c
index 48ee0f6adb..51a0ddd6b7 100644
--- 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);
@@ -561,9 +559,7 @@ static void crash_write(struct fbuf *fb, char *msgstart)
void zlog_signal(int signo, const char *action, void *siginfo_v,
void *program_counter)
{
-#ifdef SA_SIGINFO
siginfo_t *siginfo = siginfo_v;
-#endif
time_t now;
char buf[sizeof("DEFAULT: Received signal S at T (si_addr 0xP, PC 0xP); aborting...")
+ 100];
@@ -577,7 +573,6 @@ void zlog_signal(int signo, const char *action, void *siginfo_v,
msgstart = fb.pos;
bprintfrr(&fb, "Received signal %d at %lld", signo, (long long)now);
-#ifdef SA_SIGINFO
if (program_counter)
bprintfrr(&fb, " (si_addr 0x%tx, PC 0x%tx)",
(ptrdiff_t)siginfo->si_addr,
@@ -585,7 +580,6 @@ void zlog_signal(int signo, const char *action, void *siginfo_v,
else
bprintfrr(&fb, " (si_addr 0x%tx)",
(ptrdiff_t)siginfo->si_addr);
-#endif /* SA_SIGINFO */
bprintfrr(&fb, "; %s\n", action);
crash_write(&fb, msgstart);
@@ -1271,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));
@@ -1279,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
@@ -1296,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), ".");
}