From e7e55d0cc950f5d7645c9b59ada9632d83e94f65 Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Thu, 11 Oct 2018 23:21:23 +0300 Subject: [PATCH] Do not read pipe content at available size peeking Currently the same data is read twice. The first time a buffer is filled by `PeekNamedPipe` and second time it is overwritten with the same content by `ReadFile`. --- src/engine/execnt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/execnt.c b/src/engine/execnt.c index 4e512f149..a712e15d3 100644 --- a/src/engine/execnt.c +++ b/src/engine/execnt.c @@ -770,7 +770,7 @@ static void read_pipe for (;;) { /* check if we have any data to read */ - if ( !PeekNamedPipe( in, ioBuffer, IO_BUFFER_SIZE, &bytesInBuffer, + if ( !PeekNamedPipe( in, NULL, IO_BUFFER_SIZE, NULL, &bytesAvailable, NULL ) || bytesAvailable == 0 ) return;