Skip to content

Commit 7590d56

Browse files
committed
Cygwin: pipe: Add missing code restoring real_non_blocking_mode
Fixes: 940dbeffa713 ("Cygwin: pipe: Fix unexpected blocking mode change by pipe_data_available()") Reported by: Andrew Ng <[email protected]> Signed-off-by: Takashi Yano <[email protected]> (cherry picked from commit bc95e1bef29b7b1c9be00f8cd342d303466ee350)
1 parent 1fbfd96 commit 7590d56

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

winsup/cygwin/fhandler/pipe.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,10 @@ fhandler_pipe::raw_read (void *ptr, size_t& len)
392392
status = NtReadFile (get_handle (), NULL, NULL, NULL, &io, ptr,
393393
len1, NULL, NULL);
394394
if (real_non_blocking_mode)
395-
set_pipe_non_blocking (false);
395+
{
396+
set_pipe_non_blocking (false);
397+
real_non_blocking_mode = false;
398+
}
396399
if (isclosed ()) /* A signal handler might have closed the fd. */
397400
{
398401
set_errno (EBADF);
@@ -708,7 +711,10 @@ fhandler_pipe_fifo::raw_write (const void *ptr, size_t len)
708711
}
709712

710713
if (real_non_blocking_mode)
711-
((fhandler_pipe *) this)->set_pipe_non_blocking (false);
714+
{
715+
((fhandler_pipe *) this)->set_pipe_non_blocking (false);
716+
real_non_blocking_mode = false;
717+
}
712718

713719
CloseHandle (evt);
714720
if (pipe_mtx) /* pipe_mtx is NULL in the fifo case */

0 commit comments

Comments
 (0)