diff options
author | Takashi Yano <takashi.yano@nifty.ne.jp> | 2024-09-06 14:19:44 +0900 |
---|---|---|
committer | Takashi Yano <takashi.yano@nifty.ne.jp> | 2024-09-17 22:01:45 +0900 |
commit | c7fe29f5cb85242ae2607945762f7e0b9af02513 (patch) | |
tree | 5dc6ed8d8c829f0b6a7cd991f9a6796f6f4d1222 /libgloss/m32c/crt0.S | |
parent | 784ce7aff8c92b6b729e8bf5564e582360c24d8c (diff) | |
download | newlib-cygwin-3_5-branch.zip newlib-cygwin-3_5-branch.tar.gz newlib-cygwin-3_5-branch.tar.bz2 |
Cygwin: pipe: Restore blocking mode of read pipe on close()/raw_read()github/cygwin-3_5-branchcygwin-3_5-branch
If a cygwin app is executed from a non-cygwin app and the cygwin
app exits, the read pipe remains in the non-blocking mode because
of the commit fc691d0246b9. Due to this behaviour, the non-cygwin
app cannot read the pipe correctly after that. Similarly, if a
non-cygwin app is executed from a cygwin app and the non-cygwin
app exits, the read pipe remains in the blocking mode. With this
patch, the blocking mode of the read pipe is stored into a variable
was_blocking_read_pipe on set_pipe_non_blocking() when the cygwin
app starts and restored on close(). In addition, the pipe mode is
set to non-blocking mode in raw_read() if the mode is blocking
mode by referring the variable is_blocking_read_pipe as well.
is_blocking_read_pipe is a member of fhandler_pipe class and is set
by set_pipe_non_blocking(), so if other process sets the pipe mode
to blocking mode, the current process cannot know the pipe is
blocking mode. Therefore, is_blocking_read_pipe is also set on the
signal __SIGNONCYGCHLD, which is sent to the process group when
non-cygwin app is started.
Addresses: https://github.com/git-for-windows/git/issues/5115
Fixes: fc691d0246b9 ("Cygwin: pipe: Make sure to set read pipe non-blocking for cygwin apps.");
Reported-by: isaacag, Johannes Schindelin <Johannes.Schindelin@gmx.de>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>, Ken Brown <kbrown@cornell.edu>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Diffstat (limited to 'libgloss/m32c/crt0.S')
0 files changed, 0 insertions, 0 deletions