diff --git a/src/libfsm/gen.c b/src/libfsm/gen.c index 730b40724..790579dc8 100644 --- a/src/libfsm/gen.c +++ b/src/libfsm/gen.c @@ -193,7 +193,7 @@ gen_init_outer(struct fsm *fsm, size_t max_length, fsm_generate_matches_cb *cb, void *opaque, bool randomized, unsigned seed) { - int res = 0; + int res = false; if (fsm == NULL || cb == NULL || max_length == 0) { return false; } @@ -222,11 +222,11 @@ gen_init_outer(struct fsm *fsm, size_t max_length, goto cleanup; } - res = 1; + res = true; while (!ctx.done) { if (!gen_iter(&ctx)) { - res = 0; + res = false; break; } } diff --git a/src/re/main.c b/src/re/main.c index 78bc77a2f..1a0d5cbe1 100644 --- a/src/re/main.c +++ b/src/re/main.c @@ -1047,7 +1047,11 @@ main(int argc, char *argv[]) } if (generate_bounds > 0) { - return fsm_generate_matches(fsm, generate_bounds, fsm_generate_cb_printf_escaped, &opt); + if (!fsm_generate_matches(fsm, generate_bounds, fsm_generate_cb_printf_escaped, &opt)) { + exit(EXIT_FAILURE); + } + + return 0; } if (fsm_lang != FSM_PRINT_NONE) {