mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-12-26 15:17:49 +00:00
download: catch exceptions checking for size
Happens on at least one windows box
This commit is contained in:
parent
fe3f6a3e6b
commit
3813a992e4
1 changed files with 9 additions and 5 deletions
|
@ -107,13 +107,17 @@ namespace tools
|
||||||
MINFO("Content-Length: " << length);
|
MINFO("Content-Length: " << length);
|
||||||
content_length = length;
|
content_length = length;
|
||||||
boost::filesystem::path path(control->path);
|
boost::filesystem::path path(control->path);
|
||||||
boost::filesystem::space_info si = boost::filesystem::space(path);
|
try
|
||||||
if (si.available < (size_t)content_length)
|
|
||||||
{
|
{
|
||||||
const uint64_t avail = (si.available + 1023) / 1024, needed = (content_length + 1023) / 1024;
|
boost::filesystem::space_info si = boost::filesystem::space(path);
|
||||||
MERROR("Not enough space to download " << needed << " kB to " << path << " (" << avail << " kB available)");
|
if (si.available < (size_t)content_length)
|
||||||
return false;
|
{
|
||||||
|
const uint64_t avail = (si.available + 1023) / 1024, needed = (content_length + 1023) / 1024;
|
||||||
|
MERROR("Not enough space to download " << needed << " kB to " << path << " (" << avail << " kB available)");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
catch (const std::exception &e) { MWARNING("Failed to check for free space: " << e.what()); }
|
||||||
}
|
}
|
||||||
if (offset > 0)
|
if (offset > 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue