summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-02-02 11:48:07 +0300
committerVadim Yanitskiy <axilirator@gmail.com>2019-02-02 11:51:16 +0300
commitf4ba6382f57e0fb4b1e4b21a9112f6a87ef492ff (patch)
treed57638441a11ec76f79b6a27337bcd3000a2630f /src
parent9ec58916d93cc6fcae63c03be4361b8c075ea248 (diff)
mobile/gsm322.c: fix: properly print stored BA list entities
As we do iterate over all entities in the BA list, it makes more sense to print each one separately instead of printing the last one. Moreover, as soon as the iteration is finished, *ba points to some zero-initialized part of memory: gsm322.c:5170 Write stored BA list (mcc=000 mnc=000 Marshall Islands, 000) After this patch: gsm322.c:5162 Write stored BA list (mcc=250 mnc=99 Russian Federation, Beeline) gsm322.c:5162 Write stored BA list (mcc=250 mnc=01 Russian Federation, MegaFon) gsm322.c:5162 Write stored BA list (mcc=250 mnc=02 Russian Federation, MTS) gsm322.c:5162 Write stored BA list (mcc=544 mnc=31 Serbia, Telenor) Change-Id: I5160492e6125401c6a1765f54d129b1f1cd503fc
Diffstat (limited to 'src')
-rw-r--r--src/host/layer23/src/mobile/gsm322.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/host/layer23/src/mobile/gsm322.c b/src/host/layer23/src/mobile/gsm322.c
index f2b51df..7da63e3 100644
--- a/src/host/layer23/src/mobile/gsm322.c
+++ b/src/host/layer23/src/mobile/gsm322.c
@@ -5156,6 +5156,11 @@ int gsm322_exit(struct osmocom_ms *ms)
buf[2] = ba->mnc >> 8;
buf[3] = ba->mnc & 0xff;
+ LOGP(DCS, LOGL_INFO, "Write stored BA list (mcc=%s "
+ "mnc=%s %s, %s)\n", gsm_print_mcc(ba->mcc),
+ gsm_print_mnc(ba->mnc), gsm_get_mcc(ba->mcc),
+ gsm_get_mnc(ba->mcc, ba->mnc));
+
rc += fwrite(buf, 4, 1, fp);
rc += fwrite(ba->freq, sizeof(ba->freq), 1, fp);
}
@@ -5163,12 +5168,7 @@ int gsm322_exit(struct osmocom_ms *ms)
}
}
- if (rc == 2)
- LOGP(DCS, LOGL_INFO, "Write stored BA list (mcc=%s "
- "mnc=%s %s, %s)\n", gsm_print_mcc(ba->mcc),
- gsm_print_mnc(ba->mnc), gsm_get_mcc(ba->mcc),
- gsm_get_mnc(ba->mcc, ba->mnc));
- else
+ if (rc != 2)
LOGP(DCS, LOGL_ERROR, "Failed to write BA list\n");
/* free lists */