replace exit() by controlled_exit()

This commit is contained in:
Holger Vogt 2020-08-01 17:47:04 +02:00
parent 93dbc846a3
commit ab32d47860
1 changed files with 6 additions and 6 deletions

View File

@ -23,8 +23,8 @@ static void* my_open_aliki(char* fn, int nchannel) {
char p[HDRSIZE]; char p[HDRSIZE];
FILE* aldfile; FILE* aldfile;
if ((aldfile = fopen(fn, "w")) == 0) { if ((aldfile = fopen(fn, "w")) == 0) {
printf("Error: Not able to open output file '%s'\n", fn); fprintf(stderr, "Error: Not able to open output file '%s'\n", fn);
exit(1); controlled_exit(1);
} }
strcpy(p, "aliki"); strcpy(p, "aliki");
@ -42,9 +42,9 @@ static void* my_open_aliki(char* fn, int nchannel) {
memset(p + 48, 0, HDRSIZE - 48); memset(p + 48, 0, HDRSIZE - 48);
if (fwrite(p, 1, HDRSIZE, aldfile) != HDRSIZE) { if (fwrite(p, 1, HDRSIZE, aldfile) != HDRSIZE) {
printf("Error: Not able to write aliki header to '%s'\n", fn); fprintf(stderr, "Error: Not able to write aliki header to '%s'\n", fn);
fclose(aldfile); fclose(aldfile);
exit(1); controlled_exit(1);
} }
return ((void*)aldfile); return ((void*)aldfile);
} }
@ -81,8 +81,8 @@ static void* my_open_sf(char* fn, int nchannel) {
d->sf_buf = calloc(nchannel, sizeof(float)); d->sf_buf = calloc(nchannel, sizeof(float));
if ((d->outfile = sf_open(fn, SFM_WRITE, &sfinfo)) == NULL) { if ((d->outfile = sf_open(fn, SFM_WRITE, &sfinfo)) == NULL) {
printf("Error: Not able to open output file '%s'\n", fn); fprintf(stderr, "Error: Not able to open output file '%s'\n", fn);
exit(1); controlled_exit(1);
} }
#if 1 #if 1