Commit 5c97a05
committed
Cygwin: pipe: Fix hang due to inadvertent 0-length raw_write()
It is possible for `NtQueryInformationFile()` to report a 0-length
`InboundQuota` when obtaining `FilePipeLocalInformation`. This seems to
be the case e.g. when a pipe was created on the other side and its quota
information is not available on the client side.
This can lead to a situation where the `avail` variable is set to 0, and
since that is used to cap the number of bytes to send, a 0-length write.
Which hangs forever.
This was observed in the MSYS2 project when building GIMP, and reduced
to a simple test case where a MINGW `ninja.exe` tries to call an MSYS
`bison.exe` and the error message (saying that `bison` wants to have
some input) is not even shown.
Since the minimal pipe buffer size is 4k, let's ensure that it is at
least that, even when `InboundQuota` reports 0.
This fixes msys2/msys2-runtime#270
Fixes: cbfaeba (Cygwin: pipe: Fix incorrect write length in raw_write())
Helped-by: Corinna Vinschen <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>1 parent bcbfa28 commit 5c97a05
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1158 | 1158 | | |
1159 | 1159 | | |
1160 | 1160 | | |
1161 | | - | |
| 1161 | + | |
1162 | 1162 | | |
1163 | 1163 | | |
1164 | 1164 | | |
| |||
0 commit comments