Handle export errors.

This commit is contained in:
Nicolás A. Ortega 2017-02-14 12:57:11 +01:00
parent d39a51baa2
commit 659bdeee27
No known key found for this signature in database
GPG Key ID: 614272579C2070D1

View File

@ -114,7 +114,13 @@ int main(int argc, char *argv[]) {
printUsage(argv[0]);
return 0;
} else if(efile && dfile) {
exportPrimes(efile, dfile, base);
int err = exportPrimes(efile, dfile, base);
if(err) {
if(err == 1) fprintf(stderr, "Error: failed to open files.\n");
else if(err == 2) fprintf(stderr, "Error: failed to close files.\n");
else if(err == 3) fprintf(stderr, "Error: failed to write to export file.\n");
return 1;
}
return 0;
}