OSDN Git Service

* syscalls.cc (rename): Just return with 0 if filenames are identical,
authorcorinna <corinna>
Wed, 12 Mar 2008 18:54:24 +0000 (18:54 +0000)
committercorinna <corinna>
Wed, 12 Mar 2008 18:54:24 +0000 (18:54 +0000)
per POSIX.  Drop comment added in previous patch.

winsup/cygwin/ChangeLog
winsup/cygwin/syscalls.cc

index 43421a6..f36a179 100644 (file)
@@ -1,5 +1,10 @@
 2008-03-12  Corinna Vinschen  <corinna@vinschen.de>
 
+       * syscalls.cc (rename): Just return with 0 if filenames are identical,
+       per POSIX.  Drop comment added in previous patch.
+
+2008-03-12  Corinna Vinschen  <corinna@vinschen.de>
+
        * syscalls.cc (rename): Handle a special case of trying to rename a
        mount point.
 
index 548e2c6..337d502 100644 (file)
@@ -1573,17 +1573,14 @@ rename (const char *oldpath, const char *newpath)
   /* First check if oldpath and newpath only differ by case.  If so, it's
      just a request to change the case of the filename.  By simply setting
      the file attributes to INVALID_FILE_ATTRIBUTES (which translates to
-     "file doesn't exist"), all later tests are skipped.
-     If not, it's a request to change the case of the name of a mount
-     point.  If we don't catch this here, the underlying directory would
-     be deleted, if it happens to be empty. */
+     "file doesn't exist"), all later tests are skipped. */
   if (newpc.exists () && equal_path)
     {
       if (RtlEqualUnicodeString (oldpc.get_nt_native_path (),
                                 newpc.get_nt_native_path (),
                                 FALSE))
        {
-         set_errno (EACCES);
+         res = 0;
          goto out;
        }
       newpc.file_attributes (INVALID_FILE_ATTRIBUTES);