diff options
-rw-r--r-- | src/common/download.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/common/download.cpp b/src/common/download.cpp index b2f95b21a..28aac5a59 100644 --- a/src/common/download.cpp +++ b/src/common/download.cpp @@ -95,6 +95,14 @@ 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) + { + 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; + } } return true; } |