diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 8e5170f19..246e6ed34 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2001-11-10 Christopher Faylor + + * dtable.cc (dtable::build_fhandler): Don't increment console fd count + if new operation fails. Increment fork_fixup field here. + (dtable::dup2): Don't increment fork_fixup field here. + (fdsock): Ditto. + 2001-11-08 Corinna Vinschen * select.cc: Set errno using set_sig_errno() throughout. diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index 3cf52c087..4ae3871c1 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -271,8 +271,8 @@ dtable::build_fhandler (int fd, DWORD dev, const char *name, int unit) case FH_CONSOLE: case FH_CONIN: case FH_CONOUT: - fh = cnew (fhandler_console) (); - inc_console_fds (); + if ((fh = cnew (fhandler_console) ())) + inc_console_fds (); break; case FH_PTYM: fh = cnew (fhandler_pty_master) (); @@ -295,7 +295,8 @@ dtable::build_fhandler (int fd, DWORD dev, const char *name, int unit) fh = cnew (fhandler_pipe) (); break; case FH_SOCKET: - fh = cnew (fhandler_socket) (); + if ((fh = cnew (fhandler_socket) ())) + inc_need_fixup_before (); break; case FH_DISK: fh = cnew (fhandler_disk_file) (); @@ -401,10 +402,6 @@ dtable::dup2 (int oldfd, int newfd) _close (newfd); fds[newfd] = newfh; - /* Count sockets. */ - if ((fds[newfd]->get_device () & FH_DEVMASK) == FH_SOCKET) - inc_need_fixup_before (); - ReleaseResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "dup"); MALLOC_CHECK; diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 445a35327..c14a04c53 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -505,7 +505,6 @@ fdsock (int& fd, const char *name, SOCKET soc) fhandler_socket *fh = (fhandler_socket *) cygheap->fdtab.build_fhandler (fd, FH_SOCKET, name); fh->set_io_handle ((HANDLE) soc); fh->set_flags (O_RDWR); - cygheap->fdtab.inc_need_fixup_before (); fh->set_name (name, name); debug_printf ("fd %d, name '%s', soc %p", fd, name, soc); return fh;