diff options
author | Alexander Couzens <lynxis@fe80.eu> | 2016-10-04 11:24:02 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2016-10-13 11:04:48 +0000 |
commit | 3e432e1912c0e531c55e1c6c75c758b0fde9887e (patch) | |
tree | 0048f13db490a83af61ef781baf57d9cca3f03a9 /src/vty | |
parent | a23817622b28cb1969a73ffd36da501eb29b9cd7 (diff) |
vty/osmo_counter: use name if description is NULL
`show stats` shows (null) for osmocom_counters when
description is null.
OpenBSC> show stats
Ungrouped counters:
(null): 4
Change-Id: I553b88a6fca688924b1f2b49e8cb17e90f057bb1
Diffstat (limited to 'src/vty')
-rw-r--r-- | src/vty/utils.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/vty/utils.c b/src/vty/utils.c index 3a0f138b..27c1a854 100644 --- a/src/vty/utils.c +++ b/src/vty/utils.c @@ -159,9 +159,13 @@ static int handle_counter(struct osmo_counter *counter, void *vctx_) { struct vty_out_context *vctx = vctx_; struct vty *vty = vctx->vty; + const char *description = counter->description; + + if (!counter->description) + description = counter->name; vty_out(vty, " %s%s: %8lu%s", - vctx->prefix, counter->description, + vctx->prefix, description, osmo_counter_get(counter), VTY_NEWLINE); return 0; |