[PATCH] libosmocore[master]: vty: Skip printing non-initialized log categories

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

daniel gerrit-no-reply at lists.osmocom.org
Tue Nov 15 09:06:27 UTC 2016


Review at  https://gerrit.osmocom.org/1248

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
---
M src/vty/logging_vty.c
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/48/1248/1

diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c
index a23c1a7..d2fca81 100644
--- a/src/vty/logging_vty.c
+++ b/src/vty/logging_vty.c
@@ -275,6 +275,9 @@
 
 	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",

-- 
To view, visit https://gerrit.osmocom.org/1248
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieeba649c3bde6c9376d8e32b00b92beb37c08ef2
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: daniel <dwillmann at sysmocom.de>



More information about the gerrit-log mailing list