From e3778517d9c6409c9c917db83ccac20de1800a29 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 28 May 2004 19:50:07 +0000 Subject: * path.cc (chdir): Always use the normalized_path as posix_cwd, except if it starts with a drive. Also perform whitespace cleanup. --- winsup/cygwin/dir.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'winsup/cygwin/dir.cc') diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc index d0a650434..e74498fb0 100644 --- a/winsup/cygwin/dir.cc +++ b/winsup/cygwin/dir.cc @@ -292,7 +292,7 @@ rmdir (const char *dir) (DWORD) real_dir & ~FILE_ATTRIBUTE_READONLY); for (bool is_cwd = false; ; is_cwd = true) - { + { DWORD err; int rc = RemoveDirectory (real_dir); DWORD att = GetFileAttributes (real_dir); @@ -304,8 +304,8 @@ rmdir (const char *dir) /* RemoveDirectory on a samba drive doesn't return an error if the directory can't be removed because it's not empty. Checking for existence afterwards keeps us informed about success. */ - if (att == INVALID_FILE_ATTRIBUTES) - { + if (att == INVALID_FILE_ATTRIBUTES) + { res = 0; break; } @@ -327,19 +327,19 @@ rmdir (const char *dir) SetCurrentDirectory. */ if (strcasematch (real_dir, cygheap->cwd.win32) - && !strcasematch ("c:\\", cygheap->cwd.win32) + && !strcasematch ("c:\\", cygheap->cwd.win32) && !is_cwd && SetCurrentDirectory ("c:\\")) continue; - - /* On 9X ERROR_ACCESS_DENIED is returned + + /* On 9X ERROR_ACCESS_DENIED is returned if you try to remove a non-empty directory. */ if (err == ERROR_ACCESS_DENIED && wincap.access_denied_on_delete ()) err = ERROR_DIR_NOT_EMPTY; - + __seterrno_from_win_error (err); - + /* Directory still exists, restore its characteristics. */ if (real_dir.has_attribute (FILE_ATTRIBUTE_READONLY)) SetFileAttributes (real_dir, real_dir); -- cgit v1.2.3