fix lack of test for fopen() return value

This commit is contained in:
Laurent THOMAS
2025-09-09 18:04:26 +02:00
committed by Robert Schmidt
parent 82931c8f01
commit 5d118cf170
2 changed files with 19 additions and 2 deletions
+3 -2
View File
@@ -304,8 +304,9 @@ const uint16_t prach_root_sequence_map4[138] = {
57, 82, 58, 81, 59, 80, 60, 79, 61, 78, 62, 77, 63, 76, 64, 75, 65, 74, 66, 73, 67, 72, 68, 71, 69, 70};
void dump_prach_config(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) {
FILE *fd;
fd = fopen("prach_config.txt","w");
FILE *fd = fopen("prach_config.txt", "w");
if (!fd)
return;
fprintf(fd,"prach_config: subframe = %d\n",subframe);
fprintf(fd,"prach_config: N_RB_UL = %d\n",frame_parms->N_RB_UL);
fprintf(fd,"prach_config: frame_type = %s\n",(frame_parms->frame_type==1) ? "TDD":"FDD");
+16
View File
@@ -61,6 +61,8 @@ int smbv_init_config(const char* fname, uint16_t sequence_length)
int k;
f_ptr = fopen(fname,"w");
if (!f_ptr)
return -1;
if (sequence_length>4) {
msg("ERROR invalid sequence length: %d, maximum is 4\n", sequence_length);
@@ -101,6 +103,8 @@ int smbv_write_config_from_frame_parms(const char* fname, LTE_DL_FRAME_PARMS *fr
FILE *f_ptr;
f_ptr = fopen(fname,"a");
if (!f_ptr)
return -1;
fprintf(f_ptr, "BB:EUTR:SLEN %d\n",slen);
@@ -188,6 +192,8 @@ int smbv_configure_datalist_for_alloc(const char* fname, uint8_t alloc, uint8_t
{
FILE *f_ptr;
f_ptr = fopen(fname,"a");
if (!f_ptr)
return -1;
char strbuf[(8<<1)+1];
int i,k;
strbuf[0] = '\0';
@@ -245,6 +251,8 @@ int smbv_configure_datalist_for_user(const char* fname, uint8_t user, uint8_t *b
{
FILE *f_ptr;
f_ptr = fopen(fname,"a");
if (!f_ptr)
return -1;
char strbuf[(8<<1)+1];
int i,k;
@@ -284,6 +292,8 @@ int smbv_configure_user(const char* fname, uint8_t user, uint8_t transmission_mo
{
FILE *f_ptr;
f_ptr = fopen(fname,"a");
if (!f_ptr)
return -1;
fprintf(f_ptr, "BB:EUTR:DL:USER%d:TXM M1\n",user);
fprintf(f_ptr, "BB:EUTR:DL:USER%d:UEC USER\n",user);
@@ -302,6 +312,8 @@ int smbv_configure_pdcch(const char* fname,uint8_t subframe,uint8_t num_pdcch_sy
FILE *f_ptr;
f_ptr = fopen(fname,"a");
if (!f_ptr)
return -1;
fprintf(f_ptr, "BB:EUTR:DL:SUBF%d:ENCC:PCF:CREG %d\n",subframe,num_pdcch_symbols);
fprintf(f_ptr, "BB:EUTR:DL:SUBF%d:ENCC:PDCC:FORM VAR\n",subframe);
@@ -325,6 +337,8 @@ int smbv_configure_common_dci(const char* fname, uint8_t subframe, const char* t
void *dci_pdu = &dci_alloc->dci_pdu[0];
f_ptr = fopen(fname,"a");
if (!f_ptr)
return -1;
fprintf(f_ptr, "BB:EUTR:DL:SUBF%d:ENCC:STAT ON\n",subframe);
@@ -383,6 +397,8 @@ int smbv_configure_ue_spec_dci(const char* fname, uint8_t subframe, uint8_t user
void *dci_pdu = &dci_alloc->dci_pdu[0];
f_ptr = fopen(fname,"a");
if (!f_ptr)
return -1;
fprintf(f_ptr, "BB:EUTR:DL:SUBF%d:ENCC:STAT ON\n",subframe);
fprintf(f_ptr, "BB:EUTR:DL:SUBF%d:ENCC:PDCC:EXTC:ITEM%d:USER USER%d\n",subframe,item,user);