aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralois31 <alois1@gmx-topmail.de>2024-07-21 10:42:33 +0000
committerGerrit Code Review <gerrit@localhost>2024-07-21 10:42:33 +0000
commit94a8e5fe0dcee9b079c7f0658680098a989affa1 (patch)
treec15a33f137a31af345460df79a222a0b07a919e3 /src
parent4fa6961aa221b15b2c43ff081beb93a76058ceea (diff)
parent391088900e269b95710c4fa9e97e26cbe68435df (diff)
Merge "libstore/binary-cache-store: use correct buffer size for NAR decompression" into main
Diffstat (limited to 'src')
-rw-r--r--src/libstore/binary-cache-store.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libstore/binary-cache-store.cc b/src/libstore/binary-cache-store.cc
index e507391fe..6ab5a0a1c 100644
--- a/src/libstore/binary-cache-store.cc
+++ b/src/libstore/binary-cache-store.cc
@@ -336,12 +336,13 @@ WireFormatGenerator BinaryCacheStore::narFromPath(const StorePath & storePath)
try {
auto file = getFile(info->url);
return [](auto info, auto file, auto & stats) -> WireFormatGenerator {
- std::unique_ptr<char[]> buf(new char[65536]);
+ constexpr size_t buflen = 65536;
+ auto buf = std::make_unique<char []>(buflen);
size_t total = 0;
auto decompressor = makeDecompressionSource(info->compression, *file);
try {
while (true) {
- const auto len = decompressor->read(buf.get(), sizeof(buf));
+ const auto len = decompressor->read(buf.get(), buflen);
co_yield std::span{buf.get(), len};
total += len;
}