OSDN Git Service

* syscalls.cc (rename): Fix setting errno in case of trailing "/."
authorcorinna <corinna>
Thu, 27 Mar 2008 13:02:06 +0000 (13:02 +0000)
committercorinna <corinna>
Thu, 27 Mar 2008 13:02:06 +0000 (13:02 +0000)
winsup/cygwin/ChangeLog
winsup/cygwin/syscalls.cc

index 624acd3..57292c6 100644 (file)
@@ -1,5 +1,9 @@
 2008-03-27  Corinna Vinschen  <corinna@vinschen.de>
 
+       * syscalls.cc (rename): Fix setting errno in case of trailing "/."
+
+2008-03-27  Corinna Vinschen  <corinna@vinschen.de>
+
        * fhandler_socket.cc: Create shared objects session local throughout.
        * shared.cc (shared_name): Add argument to allow opening session
        local shared memory.
index d5f4683..eb3993d 100644 (file)
@@ -1497,10 +1497,16 @@ rename (const char *oldpath, const char *newpath)
   if (efault.faulted (EFAULT))
     return -1;
 
-  if (has_dot_last_component (oldpath, true)
-      || has_dot_last_component (newpath, true))
+  if (has_dot_last_component (oldpath, true))
     {
-      set_errno (EINVAL);
+      oldpc.check (oldpath, PC_SYM_NOFOLLOW, stat_suffixes);
+      set_errno (oldpc.isdir () ? EBUSY : ENOTDIR);
+      goto out;
+    }
+  if (has_dot_last_component (newpath, true))
+    {
+      newpc.check (newpath, PC_SYM_NOFOLLOW, stat_suffixes);
+      set_errno (!newpc.exists () ? ENOENT : newpc.isdir () ? EBUSY : ENOTDIR);
       goto out;
     }