laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-tetra/+/41679?usp=email )
Change subject: Fix preventing crashes when -d missing ......................................................................
Fix preventing crashes when -d missing
Small fix that check whether a dumpdir was provided with -d. If not, no voice data is written to file.
Change-Id: I6a857f62aae542b054cbb474594359da626762bb --- M src/lower_mac/tetra_lower_mac.c 1 file changed, 5 insertions(+), 2 deletions(-)
Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve
diff --git a/src/lower_mac/tetra_lower_mac.c b/src/lower_mac/tetra_lower_mac.c index f8e7810..d58f2ab 100644 --- a/src/lower_mac/tetra_lower_mac.c +++ b/src/lower_mac/tetra_lower_mac.c @@ -194,8 +194,11 @@ if (tms->cur_burst.is_traffic && type == TPSAP_T_NDB && blk_num == BLK_1) tms->cur_burst.blk1_stolen = true;
- /* If this is a traffic channel, dump. */ - if (tms->cur_burst.is_traffic && (type == TPSAP_T_SCH_F || (blk_num == BLK_2 && !tms->cur_burst.blk2_stolen))) { + /* If this is a traffic channel and we have a dump output directory, dump. */ + if (tms->dumpdir && + tms->cur_burst.is_traffic && + (type == TPSAP_T_SCH_F || (blk_num == BLK_2 && !tms->cur_burst.blk2_stolen))) { + char fname[PATH_MAX]; int16_t block[690]; FILE *f;