aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-11-10 19:46:15 +0000
committerChristopher Faylor <me@cgf.cx>2001-11-10 19:46:15 +0000
commitc8b345282934affedf2fb4a1e045d12feb7aa850 (patch)
treeca5dd6599e90d65929b0a0a940acdeb4dc876b21
parent4d2f5ef1da9610f42f8c8956820ea1dab449749a (diff)
downloadnewlib-c8b345282934affedf2fb4a1e045d12feb7aa850.zip
newlib-c8b345282934affedf2fb4a1e045d12feb7aa850.tar.gz
newlib-c8b345282934affedf2fb4a1e045d12feb7aa850.tar.bz2
* 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.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/dtable.cc11
-rw-r--r--winsup/cygwin/net.cc1
3 files changed, 11 insertions, 8 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 8e5170f..246e6ed 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -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.
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 3cf52c0..4ae3871 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 445a353..c14a04c 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;