public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: pipe: Suppress unnecessary set_pipe_non_blocking() call.
@ 2021-11-17 18:31 Takashi Yano
0 siblings, 0 replies; only message in thread
From: Takashi Yano @ 2021-11-17 18:31 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=8c1bbf2f2c50ba86f1ad607645f93af65c8b308d
commit 8c1bbf2f2c50ba86f1ad607645f93af65c8b308d
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date: Wed Nov 17 12:39:04 2021 +0900
Cygwin: pipe: Suppress unnecessary set_pipe_non_blocking() call.
- Call set_pipe_non_blocking(false) only if the pipe will be really
inherited to non-cygwin process.
Diff:
---
winsup/cygwin/spawn.cc | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 6b2026776..e160fa3bb 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -648,8 +648,9 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
if (!iscygwin ())
{
+ int fd;
cfd.rewind ();
- while (cfd.next () >= 0)
+ while ((fd = cfd.next ()) >= 0)
if (cfd->get_major () == DEV_PTYS_MAJOR)
{
fhandler_pty_slave *ptys =
@@ -657,13 +658,15 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
ptys->create_invisible_console ();
ptys->setup_locale ();
}
- else if (cfd->get_dev () == FH_PIPEW)
+ else if (cfd->get_dev () == FH_PIPEW
+ && (fd == (in__stdout < 0 ? 1 : in__stdout) || fd == 2))
{
fhandler_pipe *pipe = (fhandler_pipe *)(fhandler_base *) cfd;
pipe->close_query_handle ();
pipe->set_pipe_non_blocking (false);
}
- else if (cfd->get_dev () == FH_PIPER)
+ else if (cfd->get_dev () == FH_PIPER
+ && fd == (in__stdin < 0 ? 0 : in__stdin))
{
fhandler_pipe *pipe = (fhandler_pipe *)(fhandler_base *) cfd;
pipe->set_pipe_non_blocking (false);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-11-17 18:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-17 18:31 [newlib-cygwin] Cygwin: pipe: Suppress unnecessary set_pipe_non_blocking() call Takashi Yano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).