aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/exhaustive/exhaustive.c6
-rw-r--r--src/io/input.c8
2 files changed, 11 insertions, 3 deletions
diff --git a/src/exhaustive/exhaustive.c b/src/exhaustive/exhaustive.c
index 27a5141..53273bc 100644
--- a/src/exhaustive/exhaustive.c
+++ b/src/exhaustive/exhaustive.c
@@ -428,12 +428,14 @@ int exhaustive_do() {
exhaustive_init(&setup);
output_o_begin();
+ int result = EXIT_SUCCESS;
for (unsigned long i = 0; i < cfg->count; ++i) {
debug_log_start("Generating new curve");
curve_t *curve = curve_new();
if (!exhaustive_gen(curve, &setup, OFFSET_SEED, OFFSET_END)) {
curve_free(&curve);
- return EXIT_FAILURE;
+ result = EXIT_FAILURE;
+ break;
}
debug_log_end("Generated new curve");
@@ -447,5 +449,5 @@ int exhaustive_do() {
exhaustive_quit(&setup);
debug_log_end("Finished Exhaustive method");
- return EXIT_SUCCESS;
+ return result;
}
diff --git a/src/io/input.c b/src/io/input.c
index 5f7bfa8..971ffdf 100644
--- a/src/io/input.c
+++ b/src/io/input.c
@@ -19,7 +19,13 @@ static GEN input_i(const char *prompt, unsigned long bits) {
ssize_t len = getdelim(&line, &n, delim, in);
if (len <= 0) {
- fprintf(err, "Couldn't read an integer.\n");
+ if (feof(in)) {
+ fprintf(err, "Couldn't read an integer. Reached EOF!\n");
+ } else if (ferror(in)) {
+ perror("Couldn't read an integer.");
+ } else {
+ fprintf(err, "Couldn't read an integer.\n");
+ }
return gen_m2;
}
if (len == 1 && !feof(in)) {