mirror of https://gerrit.osmocom.org/osmo-tetra
when traffic dump directory is specified, now prints error message and exits instead of crashing when traffic file cannot be written
Change-Id: I273e07aefd9faea13662f6699a6f3b074c8efe88
This commit is contained in:
parent
f258b1d7d7
commit
16713cab01
|
@ -22,6 +22,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <linux/limits.h>
|
||||
|
||||
#include <osmocom/core/utils.h>
|
||||
|
@ -196,6 +197,10 @@ void tp_sap_udata_ind(enum tp_sap_data_type type, int blk_num, const uint8_t *bi
|
|||
snprintf(fname, sizeof(fname), "%s/traffic_%d_%d.out", tms->dumpdir,
|
||||
tms->cur_burst.is_traffic, tms->tsn);
|
||||
f = fopen(fname, "ab");
|
||||
if (!f) {
|
||||
fprintf(stderr, "Could not open dump file %s for writing: %s\n", fname, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Generate a block */
|
||||
memset(block, 0x00, sizeof(int16_t) * 690);
|
||||
|
|
Loading…
Reference in New Issue