Fix Segfault on MBE Payload directory not existing

Fix Segfault on MBE Payload directory not existing
--code will check for existence of save directory, and create it if needed to prevent a segfault.
--other minor tweak to DMR slots
This commit is contained in:
lwvmobile
2022-05-13 13:18:44 -04:00
committed by GitHub
parent 4f1ecda2ad
commit 16e84ae104
2 changed files with 14 additions and 1 deletions

View File

@@ -2085,6 +2085,10 @@ void ProcessDmrTerminaisonLC(dsd_opts * opts, dsd_state * state, uint8_t info[19
state->payload_keyid = 0;
//state->payload_mfid = 0;
state->payload_mi = 0;
state->payload_algidR = 0;
state->payload_keyidR = 0;
//state->payload_mfid = 0;
state->payload_miR = 0;
//tlc
if((IrrecoverableErrors == 0) && CRCCorrect) //amateur DMR seems to only set radio ID up here I think, figure out best way to set without messing up other DMR types

View File

@@ -68,6 +68,9 @@ comp (const void *a, const void *b)
return 1;
}
//struct for checking existence of directory to write to
struct stat st = {0};
void
noCarrier (dsd_opts * opts, dsd_state * state)
{
@@ -916,7 +919,13 @@ main (int argc, char **argv)
case 'd':
strncpy(opts.mbe_out_dir, optarg, 1023);
opts.mbe_out_dir[1023] = '\0';
fprintf (stderr,"Writing mbe data files to directory %s\n", opts.mbe_out_dir);
if (stat(opts.mbe_out_dir, &st) == -1)
{
fprintf (stderr, "-d %s directory does not exist\n", opts.mbe_out_dir);
fprintf (stderr, "Creating directory %s to save MBE files\n", opts.mbe_out_dir);
mkdir(opts.mbe_out_dir, 0700); //user read write execute, needs execute for some reason or segfault
}
else fprintf (stderr,"Writing mbe data files to directory %s\n", opts.mbe_out_dir);
break;
case 'c':
opts.rtlsdr_center_freq = (uint32_t)atofs(optarg);