Ensure fetch attempts is not reduced to less than 1.

This commit is contained in:
Michael Drake 2016-02-15 11:06:37 +00:00
parent 6b57c94012
commit d39531ff55
1 changed files with 3 additions and 2 deletions

View File

@ -192,8 +192,9 @@ static void nsoption_validate(struct nsoption_s *opts, struct nsoption_s *defs)
opts[NSOPTION_curl_fetch_timeout].value.u = 5;
if (opts[NSOPTION_curl_fetch_timeout].value.u > 60)
opts[NSOPTION_curl_fetch_timeout].value.u = 60;
while ((opts[NSOPTION_curl_fetch_timeout].value.u *
opts[NSOPTION_max_retried_fetches].value.u) > 60)
while (((opts[NSOPTION_curl_fetch_timeout].value.u *
opts[NSOPTION_max_retried_fetches].value.u) > 60) &&
(opts[NSOPTION_max_retried_fetches].value.u > 1))
opts[NSOPTION_max_retried_fetches].value.u--;
}