path: root/src/libcommon/gsm_data.c
diff options
authorAlexander Chemeris <Alexander.Chemeris@gmail.com>2017-07-11 01:42:41 +0630
committerNeels Hofmeyr <neels@hofmeyr.de>2017-08-27 17:40:55 +0200
commit6e437b752330419d909b46ebb81e205b2816d702 (patch)
tree7556f2f329cd69c36f4a9101921a3f3b1138bba3 /src/libcommon/gsm_data.c
parent57edda7fc5a8e0628bf5d383991019e4e8587daf (diff)
libcommon: Fix log output for bts>0.
Fixes regression probably introduced in c696cc28. For bts>0 logging doesn't show bts number correctly when printing lchan identification string - it will always show it as "bts=0". The reason for this is that the identification string is cached before bts->nr value is set to a proper value. This patch sets bts->nr as part of the first step of the bts structure initialization, before caching happens thus making sure the cached identification string is cached with the correct values. Change-Id: I61c18a7f021fcb1ec00d34a745f4e3ab03416c2d
Diffstat (limited to 'src/libcommon/gsm_data.c')
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libcommon/gsm_data.c b/src/libcommon/gsm_data.c
index b5bf0599..7be22408 100644
--- a/src/libcommon/gsm_data.c
+++ b/src/libcommon/gsm_data.c
@@ -254,12 +254,13 @@ struct gsm_bts *gsm_bts_alloc_register(struct gsm_network *net, enum gsm_bts_typ
if (!model && type != GSM_BTS_TYPE_UNKNOWN)
return NULL;
- bts = gsm_bts_alloc(net);
+ bts = gsm_bts_alloc(net, net->num_bts);
if (!bts)
return NULL;
+ net->num_bts++;
bts->network = net;
- bts->nr = net->num_bts++;
bts->type = type;
bts->model = model;
bts->bsic = bsic;