* 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:
		| @@ -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> | 2001-11-08  Corinna Vinschen  <corinna@vinschen.de> | ||||||
|  |  | ||||||
| 	* select.cc: Set errno using set_sig_errno() throughout. | 	* select.cc: Set errno using set_sig_errno() throughout. | ||||||
|   | |||||||
| @@ -271,8 +271,8 @@ dtable::build_fhandler (int fd, DWORD dev, const char *name, int unit) | |||||||
|       case FH_CONSOLE: |       case FH_CONSOLE: | ||||||
|       case FH_CONIN: |       case FH_CONIN: | ||||||
|       case FH_CONOUT: |       case FH_CONOUT: | ||||||
| 	fh = cnew (fhandler_console) (); | 	if ((fh = cnew (fhandler_console) ())) | ||||||
| 	inc_console_fds (); | 	  inc_console_fds (); | ||||||
| 	break; | 	break; | ||||||
|       case FH_PTYM: |       case FH_PTYM: | ||||||
| 	fh = cnew (fhandler_pty_master) (); | 	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) (); | 	fh = cnew (fhandler_pipe) (); | ||||||
| 	break; | 	break; | ||||||
|       case FH_SOCKET: |       case FH_SOCKET: | ||||||
| 	fh = cnew (fhandler_socket) (); | 	if ((fh = cnew (fhandler_socket) ())) | ||||||
|  | 	  inc_need_fixup_before (); | ||||||
| 	break; | 	break; | ||||||
|       case FH_DISK: |       case FH_DISK: | ||||||
| 	fh = cnew (fhandler_disk_file) (); | 	fh = cnew (fhandler_disk_file) (); | ||||||
| @@ -401,10 +402,6 @@ dtable::dup2 (int oldfd, int newfd) | |||||||
|     _close (newfd); |     _close (newfd); | ||||||
|   fds[newfd] = newfh; |   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"); |   ReleaseResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "dup"); | ||||||
|   MALLOC_CHECK; |   MALLOC_CHECK; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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); |   fhandler_socket *fh = (fhandler_socket *) cygheap->fdtab.build_fhandler (fd, FH_SOCKET, name); | ||||||
|   fh->set_io_handle ((HANDLE) soc); |   fh->set_io_handle ((HANDLE) soc); | ||||||
|   fh->set_flags (O_RDWR); |   fh->set_flags (O_RDWR); | ||||||
|   cygheap->fdtab.inc_need_fixup_before (); |  | ||||||
|   fh->set_name (name, name); |   fh->set_name (name, name); | ||||||
|   debug_printf ("fd %d, name '%s', soc %p", fd, name, soc); |   debug_printf ("fd %d, name '%s', soc %p", fd, name, soc); | ||||||
|   return fh; |   return fh; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user