[PATCH] Cygwin: select: Set errno when peek() returns -1

Corinna Vinschen corinna-cygwin@cygwin.com
Sun Apr 19 10:23:49 GMT 2026


On Apr 18 04:45, Takashi Yano wrote:
> Currently, poll() sometimes returns -1 with errno == 0 if the fd is
> not opened. This is due to lack of setting errno when peek() fails.
> This patch ensure to set errno to thread_errno if peek() returns
> NULL.
> 
> Addresses: https://cygwin.com/pipermail/cygwin/2026-April/259602.html
> Fixes: 8382778cdb57 ("Cygwin: console: fix select() behaviour")
> Reported-by: Nahor <nahor.j+cygwin@gmail.com>
> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
> Reviewed-by:
> ---
>  winsup/cygwin/select.cc | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Looks like an obvious fix :)

Thanks,
Corinna


More information about the Cygwin-patches mailing list