On Jan 15 14:45, Ben Wijen wrote:
> Speedup deletion of directories.
> ---
>  winsup/cygwin/dir.cc | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc
> index f912a9e47..2e7da3638 100644
> --- a/winsup/cygwin/dir.cc
> +++ b/winsup/cygwin/dir.cc
> @@ -22,6 +22,8 @@ details. */
>  #include "cygtls.h"
>  #include "tls_pbuf.h"
>  
> +extern NTSTATUS unlink_nt (const char *ourname, ULONG eflags);
> +
>  extern "C" int
>  dirfd (DIR *dir)
>  {
> @@ -398,6 +400,10 @@ rmdir (const char *dir)
>         if (msdos && p == dir + 1 && isdrive (dir))
>           p[1] = '\\';
>       }
> +      if(NT_SUCCESS(unlink_nt (dir, FILE_DIRECTORY_FILE))) {
          ^^         ^^
          spaces

Your code is skipping the safety checks and the has_dot_last_component()
check.  The latter implements a check required by POSIX.  Skipping
it introduces an incompatibility, see man 2 rmdir.


Corinna

Reply via email to