delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/08/16/04:05:35

From: TYann AT vet DOT com DOT au (Trevor Yann)
Subject: error code fix for rmdir under win95/98
16 Aug 1998 04:05:35 -0700 :
Message-ID: <3.0.5.32.19980816194416.007ee890.cygnus.cygwin32.developers@mail.mel.cybec.com.au>
Mime-Version: 1.0
To: cygwin32-developers AT cygnus DOT com

An attempt to remove a non-empty directory is reported differently under NT
than it is under Windows 95/98. NT correctly returns the error
DIR_NOT_EMPTY, but both Windows 95 and Windows 98 return
ERROR_ACCESS_DENIED. This fix allows a correct error code to be returned.

dir.cc	(rmdir): return correct error code when attempting to remove a
non-empty directory under windows 95/98

diff -ur winsup.original/dir.cc winsup/dir.cc
--- winsup.original/dir.cc	Tue Jun 02 04:21:12 1998
+++ winsup/dir.cc	Fri Aug 14 22:27:56 1998
@@ -294,6 +294,12 @@
 
   if (RemoveDirectoryA (real_dir.get_win32 ()))
     res = 0;
+  else if (os_being_run != winNT && GetLastError() == ERROR_ACCESS_DENIED)
+    {
+      /* Under Windows 95 & 98, ERROR_ACCESS_DENIED is returned
+         if you try to remove a directory that is not empty. */
+      set_errno (ENOTEMPTY);
+    }
   else
     __seterrno ();
 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019