[PATCH] openbsc[master]: gsm_trx_name(): don't break if trx is NULL

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Oct 10 01:27:46 UTC 2016


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

gsm_trx_name(): don't break if trx is NULL

Just as a general precaution deemed to fit such a convenience function that
lives in libcommon, no actual failure observed.

Change-Id: I8e77fe1abc402469fd037e2fde2f46e2c8114f59
---
M openbsc/src/libcommon/gsm_data_shared.c
1 file changed, 5 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/33/1033/1

diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c
index 4eea21e..b8853ad 100644
--- a/openbsc/src/libcommon/gsm_data_shared.c
+++ b/openbsc/src/libcommon/gsm_data_shared.c
@@ -328,8 +328,11 @@
 
 char *gsm_trx_name(const struct gsm_bts_trx *trx)
 {
-	snprintf(ts2str, sizeof(ts2str), "(bts=%d,trx=%d)",
-		 trx->bts->nr, trx->nr);
+	if (!trx)
+		snprintf(ts2str, sizeof(ts2str), "(trx=NULL)");
+	else
+		snprintf(ts2str, sizeof(ts2str), "(bts=%d,trx=%d)",
+			 trx->bts->nr, trx->nr);
 
 	return ts2str;
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8e77fe1abc402469fd037e2fde2f46e2c8114f59
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list