Cygwin: pipe: Fix incorrect write length in raw_write()
If the write length is more than the pipe space in non-blocking
mode, the write length is wrongly set to 65536. This causes access
violation. This patch fixes that.
Fixes: 7ed9adb356
("Cygwin: pipe: Switch pipe mode to blocking mode by default")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
This commit is contained in:
parent
df0953aa29
commit
cbfaeba4f7
|
@ -532,10 +532,8 @@ fhandler_pipe_fifo::raw_write (const void *ptr, size_t len)
|
|||
}
|
||||
}
|
||||
|
||||
if (len <= (size_t) avail || pipe_buf_size == 0)
|
||||
if (len <= (size_t) avail)
|
||||
chunk = len;
|
||||
else if (is_nonblocking ())
|
||||
chunk = len = pipe_buf_size;
|
||||
else
|
||||
chunk = avail;
|
||||
|
||||
|
@ -555,7 +553,7 @@ fhandler_pipe_fifo::raw_write (const void *ptr, size_t len)
|
|||
ULONG len1;
|
||||
DWORD waitret = WAIT_OBJECT_0;
|
||||
|
||||
if (left > chunk)
|
||||
if (left > chunk && !is_nonblocking ())
|
||||
len1 = chunk;
|
||||
else
|
||||
len1 = (ULONG) left;
|
||||
|
|
Loading…
Reference in New Issue