diff options
Diffstat (limited to 'winsup/cygwin/fhandler_proc.cc')
-rw-r--r-- | winsup/cygwin/fhandler_proc.cc | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc index 63178a003..94007cae1 100644 --- a/winsup/cygwin/fhandler_proc.cc +++ b/winsup/cygwin/fhandler_proc.cc @@ -220,6 +220,26 @@ fhandler_proc::fstat (struct __stat64 *buf) return -1; } +DIR * +fhandler_proc::opendir (int fd) +{ + DIR *dir = fhandler_virtual::opendir (fd); + if (dir && !(dir->__handle = (void *) new winpids ((DWORD) 0))) + { + free (dir); + dir = NULL; + set_errno (ENOMEM); + } + return dir; +} + +int +fhandler_proc::closedir (DIR *dir) +{ + free (dir->__handle); + return fhandler_virtual::closedir (dir); +} + int fhandler_proc::readdir (DIR *dir, dirent *de) { @@ -232,7 +252,7 @@ fhandler_proc::readdir (DIR *dir, dirent *de) } else { - winpids pids ((DWORD) 0); + winpids &pids = *(winpids *) dir->__handle; int found = 0; res = ENMFILE; for (unsigned i = 0; i < pids.npids; i++) |