aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/filetransfer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/filetransfer.cc')
-rw-r--r--src/libstore/filetransfer.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libstore/filetransfer.cc b/src/libstore/filetransfer.cc
index 10c810e49..34b92148e 100644
--- a/src/libstore/filetransfer.cc
+++ b/src/libstore/filetransfer.cc
@@ -6,6 +6,7 @@
#include "signals.hh"
#include "compression.hh"
#include "strings.hh"
+#include <cstddef>
#if ENABLE_S3
#include <aws/core/client/ClientConfiguration.h>
@@ -115,7 +116,7 @@ struct curlFileTransfer : public FileTransfer
if (!done)
fail(FileTransferError(Interrupted, {}, "download of '%s' was interrupted", request.uri));
} catch (...) {
- ignoreException();
+ ignoreExceptionInDestructor();
}
}
@@ -784,8 +785,10 @@ struct curlFileTransfer : public FileTransfer
size_t read(char * data, size_t len) override
{
- auto readPartial = [this](char * data, size_t len) {
+ auto readPartial = [this](char * data, size_t len) -> size_t {
const auto available = std::min(len, buffered.size());
+ if (available == 0u) return 0u;
+
memcpy(data, buffered.data(), available);
buffered.remove_prefix(available);
return available;