Skip to content
Snippets Groups Projects
Commit 9a57677a authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Avoid possible divide-by-zero in gettimetodl()

Default to 100000 (cps) if passed a rate_cps argument value of 0.
parent 8de13f8e
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -655,12 +655,15 @@ time_t getfiletime(scfg_t* cfg, file_t* f)
return f->time;
}
// Return estimated time to transfer file, in seconds
ulong gettimetodl(scfg_t* cfg, file_t* f, uint rate_cps)
{
if(getfilesize(cfg, f) < 1)
return 0;
if(f->size <= (off_t)rate_cps)
return 1;
if(rate_cps < 1)
rate_cps = 100000;
return (ulong)(f->size / rate_cps);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment