aboutsummaryrefslogtreecommitdiff
path: root/src/nix-daemon
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-03-22 13:19:25 +0100
committerEelco Dolstra <edolstra@gmail.com>2018-03-22 13:19:25 +0100
commitf87e286e82f37c3746ba62ba5503db90277eeb6e (patch)
tree627a0914bf495a43969a3448d0a05049a5b078ea /src/nix-daemon
parent92aee1b7d69adc9552dc0efae9d030e02aa2f353 (diff)
parent6b9a03f5d878ae434b54bb883b51e28082dc30b3 (diff)
Merge branch 'fix/avoid-large-stack-buffers' of https://github.com/dtzWill/nix
Diffstat (limited to 'src/nix-daemon')
-rw-r--r--src/nix-daemon/nix-daemon.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc
index 50258018a..f28a52b73 100644
--- a/src/nix-daemon/nix-daemon.cc
+++ b/src/nix-daemon/nix-daemon.cc
@@ -37,13 +37,13 @@ using namespace nix;
static ssize_t splice(int fd_in, void *off_in, int fd_out, void *off_out, size_t len, unsigned int flags)
{
/* We ignore most parameters, we just have them for conformance with the linux syscall */
- char buf[8192];
- auto read_count = read(fd_in, buf, sizeof(buf));
+ std::vector<char> buf(8192);
+ auto read_count = read(fd_in, buf.data(), buf.size());
if (read_count == -1)
return read_count;
auto write_count = decltype(read_count)(0);
while (write_count < read_count) {
- auto res = write(fd_out, buf + write_count, read_count - write_count);
+ auto res = write(fd_out, buf.data() + write_count, read_count - write_count);
if (res == -1)
return res;
write_count += res;