cygwin 3.3.x: another problem that may be related to pipes
Takashi Yano
takashi.yano@nifty.ne.jp
Tue Nov 16 10:20:15 GMT 2021
On Tue, 16 Nov 2021 18:45:15 +0900
Takashi Yano wrote:
> Hi Ken,
>
> I noticed the following while fixing this issue.
>
> We now noticed that NtWriteFile() may return STATUS_PENDING
> even in nonblocking mode.
>
> If NtWriteFile() returns STATUS_PENDING in nonblocking mode,
> does not the following 'if' block in raw_write() refer to
> uninitialized io.Information?
>
> while (len1 > 0)
> {
> status = NtWriteFile (get_handle (), evt, NULL, NULL, &io,
> (PVOID) ptr, len1, NULL, NULL);
> if (evt || !NT_SUCCESS (status) || io.Information > 0
> || len <= PIPE_BUF)
> break;
> len1 >>= 1;
> }
>
> 'evt' is false if we are in nonblocking mode.
> '!NT_SUCCESS(status)' is false if status == STATUS_PENDING.
> Then io.Information would be referred I think.
>
> Isn't this another bug in raw_write()?
>
> What should we do in this case? Should we do like:
>
> if (evt || !NT_SUCCESS (status) || status == STATUS_PENDING
> || io.Information > 0 || len <= PIPE_BUF)
>
> ?
Answer to myself.
I think moving cygwait(evt, ...) before this 'if' block is the
right thing.
Right? If so, I will submit v3 patch.
--
Takashi Yano <takashi.yano@nifty.ne.jp>
More information about the Cygwin-developers
mailing list