* 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.
This commit is contained in:
Christopher Faylor 2001-11-10 19:46:15 +00:00
parent 4d2f5ef1da
commit c8b3452829
3 changed files with 11 additions and 8 deletions

View File

@ -1,3 +1,10 @@
2001-11-10 Christopher Faylor <cgf@redhat.com>
* 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 <corinna@vinschen.de>
* select.cc: Set errno using set_sig_errno() throughout.

View File

@ -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;

View File

@ -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;