aboutsummaryrefslogtreecommitdiff
path: root/src/common/download.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-11-25 21:49:36 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-11-26 18:42:00 +0000
commit3813a992e4536af1aa9eb966337b3e247dac6812 (patch)
treee391e4f9cac58bc2ed8b4767adc321d62fc376df /src/common/download.cpp
parentMerge pull request #6097 (diff)
downloadmonero-3813a992e4536af1aa9eb966337b3e247dac6812.tar.xz
download: catch exceptions checking for size
Happens on at least one windows box
Diffstat (limited to 'src/common/download.cpp')
-rw-r--r--src/common/download.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/common/download.cpp b/src/common/download.cpp
index f07d6798d..2b6a3f9d3 100644
--- a/src/common/download.cpp
+++ b/src/common/download.cpp
@@ -107,13 +107,17 @@ namespace tools
MINFO("Content-Length: " << length);
content_length = length;
boost::filesystem::path path(control->path);
- boost::filesystem::space_info si = boost::filesystem::space(path);
- if (si.available < (size_t)content_length)
+ try
{
- 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;
+ boost::filesystem::space_info si = boost::filesystem::space(path);
+ if (si.available < (size_t)content_length)
+ {
+ 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)
{