Skip to content

Commit

Permalink
Wrong exit status for -G.
Browse files Browse the repository at this point in the history
Spotted by @pierreganty (#478), thank you
  • Loading branch information
katef committed Aug 24, 2024
1 parent 98fe88b commit 84f3835
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/libfsm/gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/re/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 84f3835

Please sign in to comment.