1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

Merge branch 'fix/avoid-large-stack-buffers' of https://github.com/dtzWill/nix

This commit is contained in:
Eelco Dolstra 2018-03-22 13:19:25 +01:00
commit f87e286e82
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
5 changed files with 27 additions and 26 deletions

View file

@ -4161,10 +4161,10 @@ void Worker::waitForInput()
assert(goal);
set<int> fds2(j->fds);
std::vector<unsigned char> buffer(4096);
for (auto & k : fds2) {
if (FD_ISSET(k, &fds)) {
unsigned char buffer[4096];
ssize_t rd = read(k, buffer, sizeof(buffer));
ssize_t rd = read(k, buffer.data(), buffer.size());
if (rd == -1) {
if (errno != EINTR)
throw SysError(format("reading from %1%")
@ -4176,7 +4176,7 @@ void Worker::waitForInput()
} else {
printMsg(lvlVomit, format("%1%: read %2% bytes")
% goal->getName() % rd);
string data((char *) buffer, rd);
string data((char *) buffer.data(), rd);
j->lastOutput = after;
goal->handleChildOutput(k, data);
}