Fail wsprd if data directory specified not accessible

Also fixed trivial memory leak on error exit.
This commit is contained in:
Bill Somerville 2020-12-03 13:12:12 +00:00
parent 3134dd8a60
commit ac6a6d0cd7
No known key found for this signature in database
GPG Key ID: D864B06D1E81618F

View File

@ -875,8 +875,10 @@ int main(int argc, char *argv[])
}
}
if( stackdecoder ) {
stack=calloc(stacksize,sizeof(struct snode));
if( access(data_dir, R_OK | W_OK)) {
fprintf(stderr, "Error: inaccessible data directory: '%s'\n", data_dir);
usage();
return EXIT_FAILURE;
}
if( optind+1 > argc) {
@ -886,6 +888,10 @@ int main(int argc, char *argv[])
ptr_to_infile=argv[optind];
}
if( stackdecoder ) {
stack=calloc(stacksize,sizeof(struct snode));
}
// setup metric table
for(i=0; i<256; i++) {
mettab[0][i]=round( 10*(metric_tables[2][i]-bias) );