mirror of
https://github.com/ohwgiles/laminar.git
synced 2024-10-27 20:34:20 +00:00
attempt to solve segfault under hardened gentoo
Can't reproduce this locally, but looks like using a std::string as an arbitrary buffer is causing problems. See #19
This commit is contained in:
parent
9c92c5b514
commit
b70e501d6d
@ -456,9 +456,8 @@ void Server::acceptRpcClient(kj::Own<kj::ConnectionReceiver>&& listener) {
|
||||
// wrapped by stream and invoke the provided callback with the read data.
|
||||
// Repeats until ::read returns <= 0
|
||||
kj::Promise<void> Server::handleFdRead(kj::AsyncInputStream* stream, std::function<void(const char*,size_t)> cb) {
|
||||
std::string buffer;
|
||||
buffer.reserve(PROC_IO_BUFSIZE);
|
||||
return stream->tryRead((void*)buffer.data(), 1, PROC_IO_BUFSIZE).then(kj::mvCapture(kj::mv(buffer), [this,stream,cb](std::string&& buffer, size_t sz) {
|
||||
std::vector<char> buffer(PROC_IO_BUFSIZE);
|
||||
return stream->tryRead((void*)buffer.data(), 1, PROC_IO_BUFSIZE).then(kj::mvCapture(kj::mv(buffer), [this,stream,cb](std::vector<char>&& buffer, size_t sz) {
|
||||
if(sz > 0) {
|
||||
cb(buffer.data(), sz);
|
||||
return handleFdRead(stream, cb);
|
||||
|
Loading…
Reference in New Issue
Block a user