From 4f7ac76aae140bb9de50fe4c81e3cf6d23b100e2 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 10 Sep 2000 16:43:47 +0000 Subject: [PATCH] * dcrt0.cc (dll_crt0_1): Initialize thread and debug stuff before handling exec/fork. * dtable.cc (dtable::fixup_after_exec): Always clear out the read ahead buffer whether closing or adjusting. * path.cc (chdir): Avoid a compiler warning. --- winsup/cygwin/ChangeLog | 8 ++++++++ winsup/cygwin/dcrt0.cc | 7 ++++--- winsup/cygwin/dtable.cc | 12 ++++++------ winsup/cygwin/path.cc | 2 +- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index ab308e5b3..ebac8092a 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +Sun Sep 10 12:40:49 2000 Christopher Faylor + + * dcrt0.cc (dll_crt0_1): Initialize thread and debug stuff before + handling exec/fork. + * dtable.cc (dtable::fixup_after_exec): Always clear out the read ahead + buffer whether closing or adjusting. + * path.cc (chdir): Avoid a compiler warning. + Sat Sep 9 23:29:17 2000 Christopher Faylor * path.cc (chdir): Use the full path for cwd_win32. Consider attempts diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index cc48d7389..ac67eb807 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -644,6 +644,10 @@ dll_crt0_1 () user_data->resourcelocks->Init (); user_data->threadinterface->Init0 (); + + threadname_init (); + debug_init (); + regthread ("main", GetCurrentThreadId ()); char **envp = NULL; @@ -713,9 +717,6 @@ dll_crt0_1 () /* Initialize events. */ events_init (); - threadname_init (); - debug_init (); - /* Allow backup semantics. It's better done only once on process start instead of each time a file is opened. */ set_process_privileges (); diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index 9e7b3c5d5..b2a765a3e 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -445,13 +445,13 @@ dtable::fixup_after_exec (HANDLE parent, size_t sz, fhandler_base **f) first_fd_for_open = 0; for (size_t i = 0; i < size; i++) if (fds[i]) - if (fds[i]->get_close_on_exec ()) - release (i); - else - { - fds[i]->clear_readahead (); + { + fds[i]->clear_readahead (); + if (fds[i]->get_close_on_exec ()) + release (i); + else fds[i]->fixup_after_exec (parent); - } + } } void diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index bef272316..58a1fb8bc 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -2507,7 +2507,7 @@ chdir (const char *dir) else p++; - int len = strlen (p); + size_t len = strlen (p); if (len > 2 && strspn (p, ".") == len) { set_errno (ENOENT);