aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorAlexander Blair <snipa@jagtech.io>2020-02-06 00:34:58 -0800
committerAlexander Blair <snipa@jagtech.io>2020-02-06 00:34:58 -0800
commitbd4acbf44c8e04f2915f03106c9680a859610efd (patch)
tree3ec59758a3d3a867622cd27490634735e41106fa /src/common
parentMerge pull request #6182 (diff)
parentdownload: catch exceptions checking for size (diff)
downloadmonero-bd4acbf44c8e04f2915f03106c9680a859610efd.tar.xz
Merge pull request #6183
3813a992 download: catch exceptions checking for size (moneromooo-monero)
Diffstat (limited to 'src/common')
-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)
{