summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/parse.c10
-rw-r--r--tests/bfs/j0.sh1
2 files changed, 10 insertions, 1 deletions
diff --git a/src/parse.c b/src/parse.c
index c225a5b..6b1eaa0 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -1623,11 +1623,19 @@ static struct bfs_expr *parse_jobs(struct parser_state *state, int arg1, int arg
return NULL;
}
- if (!parse_int(state, expr->argv, expr->argv[0] + 2, &state->ctx->threads, IF_INT | IF_UNSIGNED)) {
+ unsigned int n;
+ if (!parse_int(state, expr->argv, expr->argv[0] + 2, &n, IF_INT | IF_UNSIGNED)) {
bfs_expr_free(expr);
return NULL;
}
+ if (n == 0) {
+ parse_expr_error(state, expr, "${bld}0${rs} is not enough threads.\n");
+ bfs_expr_free(expr);
+ return NULL;
+ }
+
+ state->ctx->threads = n;
return expr;
}
diff --git a/tests/bfs/j0.sh b/tests/bfs/j0.sh
new file mode 100644
index 0000000..97a7c5c
--- /dev/null
+++ b/tests/bfs/j0.sh
@@ -0,0 +1 @@
+! invoke_bfs -j0 basic