Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2003-02-20 17:14:37 +0300
committerCorinna Vinschen <corinna@vinschen.de>2003-02-20 17:14:37 +0300
commit518f5d4935235da84435c69d254b826dee5186f2 (patch)
treed43f1193c288dd2f767221d9ff8e7573fc84a90c /winsup/cygwin/fhandler_virtual.cc
parent1374b148ba05b8ff93032e3c5cfc4c9e6a85e572 (diff)
* fhandler_disk_file.cc (fhandler_disk_file::opendir): Check descriptor
created by cygheap_fdnew constructor. * fhandler_virtual.cc (fhandler_virtual::opendir): Ditto. * fhandler_socket.cc (fhandler_socket::accept): Ditto and move creation of file descriptor behind blocking OS call. * net.cc (cygwin_socket): Ditto. (cygwin_rcmd): Ditto. (cygwin_rresvport): Ditto. (cygwin_rexec): Ditto. (socketpair): Ditto.
Diffstat (limited to 'winsup/cygwin/fhandler_virtual.cc')
-rw-r--r--winsup/cygwin/fhandler_virtual.cc23
1 files changed, 13 insertions, 10 deletions
diff --git a/winsup/cygwin/fhandler_virtual.cc b/winsup/cygwin/fhandler_virtual.cc
index 4316efa69..f8f3519a8 100644
--- a/winsup/cygwin/fhandler_virtual.cc
+++ b/winsup/cygwin/fhandler_virtual.cc
@@ -74,16 +74,19 @@ fhandler_virtual::opendir (path_conv& pc)
strcpy (dir->__d_dirname, get_name ());
dir->__d_dirent->d_version = __DIRENT_VERSION;
cygheap_fdnew fd;
- fd = this;
- fd->set_nohandle (true);
- dir->__d_dirent->d_fd = fd;
- dir->__d_u.__d_data.__fh = this;
- dir->__d_cookie = __DIRENT_COOKIE;
- dir->__d_u.__d_data.__handle = INVALID_HANDLE_VALUE;
- dir->__d_position = 0;
- dir->__d_dirhash = get_namehash ();
-
- res = dir;
+ if (fd >= 0)
+ {
+ fd = this;
+ fd->set_nohandle (true);
+ dir->__d_dirent->d_fd = fd;
+ dir->__d_u.__d_data.__fh = this;
+ dir->__d_cookie = __DIRENT_COOKIE;
+ dir->__d_u.__d_data.__handle = INVALID_HANDLE_VALUE;
+ dir->__d_position = 0;
+ dir->__d_dirhash = get_namehash ();
+
+ res = dir;
+ }
}
syscall_printf ("%p = opendir (%s)", res, get_name ());