Skip to content

Commit ee051c4

Browse files
committed
Add a check to prevent max_children from being 0.
In function fetch_multiple and fetch_submodules, `multiple` is stored in `opt.process` and later used as a divisor in function `pp_collect_finished`, creating a potential divide-by-zero if it remains zero. Signed-off-by: Alex Guo <[email protected]>
1 parent 8613c2b commit ee051c4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

builtin/fetch.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2591,7 +2591,7 @@ int cmd_fetch(int argc,
25912591
die(_("--stdin can only be used when fetching "
25922592
"from one remote"));
25932593

2594-
if (max_children < 0)
2594+
if (max_children <= 0)
25952595
max_children = config.parallel;
25962596

25972597
/* TODO should this also die if we have a previous partial-clone? */
@@ -2613,9 +2613,9 @@ int cmd_fetch(int argc,
26132613
struct strvec options = STRVEC_INIT;
26142614
int max_children = max_jobs;
26152615

2616-
if (max_children < 0)
2616+
if (max_children <= 0)
26172617
max_children = config.submodule_fetch_jobs;
2618-
if (max_children < 0)
2618+
if (max_children <= 0)
26192619
max_children = config.parallel;
26202620

26212621
add_options_to_argv(&options, &config);

0 commit comments

Comments
 (0)