summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <daniel@totalueberwachung.de>2016-11-15 10:05:51 +0100
committerHarald Welte <laforge@gnumonks.org>2016-11-15 22:31:19 +0000
commit55363a9f621566d82fc30408a6c657d9e81f5789 (patch)
tree70aefdb55ade8750c824c9cd39a501a2c425019e
parent8593f1f57a5140a34cd4f7063c2e7fcb54e1837b (diff)
vty: Skip printing non-initialized log categories
Without this patch the vty command show logging vty will cause a segfault if not all elements of the log_categories array are defined. Ticket: OW#3053 Sponsored-by: On-Waves ehf Change-Id: Ieeba649c3bde6c9376d8e32b00b92beb37c08ef2
-rw-r--r--src/vty/logging_vty.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c
index a23c1a74..d2fca819 100644
--- a/src/vty/logging_vty.c
+++ b/src/vty/logging_vty.c
@@ -275,6 +275,9 @@ static void vty_print_logtarget(struct vty *vty, const struct log_info *info,
for (i = 0; i < info->num_cat; i++) {
const struct log_category *cat = &tgt->categories[i];
+ /* Skip categories that were not initialized */
+ if (!info->cat[i].name)
+ continue;
vty_out(vty, " %-10s %-10s %-8s %s%s",
info->cat[i].name+1, log_level_str(cat->loglevel),
cat->enabled ? "Enabled" : "Disabled",