diff --git a/lib/wsprd/wsprd.c b/lib/wsprd/wsprd.c index 522b7097f..8ef66fd19 100644 --- a/lib/wsprd/wsprd.c +++ b/lib/wsprd/wsprd.c @@ -875,10 +875,12 @@ 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) { usage(); return 1; @@ -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) );