From 2e78b61dcaf7fb107f8ae4f37246a6c753cf78f5 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 25 Oct 2000 14:17:27 +0000 Subject: [PATCH] * dtable.cc (dtable::fixup_after_exec): Use variable rather than constantly indexing into fds array. (dtable::fixup_after_fork): Ditto. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/dtable.cc | 15 ++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index c0ff45808..5d00f4b53 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +Wed Oct 25 09:59:14 2000 Christopher Faylor + + * dtable.cc (dtable::fixup_after_exec): Use variable rather than + constantly indexing into fds array. + (dtable::fixup_after_fork): Ditto. + Wed Oct 25 10:43:00 2000 Corinna Vinschen * fhandler.cc (fhandler_base::fcntl): Treat O_NONBLOCK and OLD_O_NDELAY diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index accf7070a..b08d547b8 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -449,19 +449,20 @@ dtable::fixup_after_exec (HANDLE parent, size_t sz, fhandler_base **f) size = sz; fds = f; first_fd_for_open = 0; + fhandler_base *fh; for (size_t i = 0; i < size; i++) - if (fds[i]) + if ((fh = fds[i]) != NULL) { - fds[i]->clear_readahead (); - if (fds[i]->get_close_on_exec ()) + fh->clear_readahead (); + if (fh->get_close_on_exec ()) release (i); else { - fds[i]->fixup_after_exec (parent); + fh->fixup_after_exec (parent); if (i == 0) - SetStdHandle (std_consts[i], fds[i]->get_io_handle ()); + SetStdHandle (std_consts[i], fh->get_io_handle ()); else if (i <= 2) - SetStdHandle (std_consts[i], fds[i]->get_output_handle ()); + SetStdHandle (std_consts[i], fh->get_output_handle ()); } } } @@ -474,7 +475,7 @@ dtable::fixup_after_fork (HANDLE parent) for (size_t i = 0; i < size; i++) if ((fh = fds[i]) != NULL) { - if (fds[i]->get_close_on_exec () || fh->get_need_fork_fixup ()) + if (fh->get_close_on_exec () || fh->get_need_fork_fixup ()) { debug_printf ("fd %d(%s)", i, fh->get_name ()); fh->fixup_after_fork (parent);