From e387a378b452c5524665b149af41779c416134fa Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 22 Feb 2007 15:07:21 +0000 Subject: [PATCH] * fhandler_disk_file.cc (fhandler_disk_file::closedir): Fix bug introduced by switching to NtClose. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/fhandler_disk_file.cc | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 37f3dd9f0..8c99c3c42 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2007-02-22 Corinna Vinschen + + * fhandler_disk_file.cc (fhandler_disk_file::closedir): Fix bug + introduced by switching to NtClose. + 2007-02-22 Christopher Faylor * dcrt0.cc (child_info_fork::alloc_stack_hard_way): Change sense of diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 94a94b8fa..9bc7b834a 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1873,6 +1873,8 @@ int fhandler_disk_file::closedir (DIR *dir) { int res = 0; + NTSTATUS status; + delete d_mounts (dir); if (!dir->__handle) /* ignore */; @@ -1881,9 +1883,9 @@ fhandler_disk_file::closedir (DIR *dir) set_errno (EBADF); res = -1; } - else if (!NtClose (dir->__handle)) + else if (!NT_SUCCESS (status = NtClose (dir->__handle))) { - __seterrno (); + __seterrno_from_nt_status (status); res = -1; } syscall_printf ("%d = closedir (%p, %s)", res, dir, get_name ());