This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [1.7] rename/renameat error


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Christopher Faylor on 9/26/2009 8:57 AM:
>> But how does it look now?
> 
> It looks good.  Thanks.  Please check in.

I missed one corner case in my testing; how about this followup?

2009-09-29  Eric Blake  <ebb9@byu.net>

	* syscalls.cc (rename): Fix regression on rename("dir","d/").

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrCXWsACgkQ84KuGfSFAYAM1gCgy1EXKJouKOh4WBCAKsnYhd1z
SfoAnibntBW3fCJxo1mG/XFAcfO5HyCU
=QLdB
-----END PGP SIGNATURE-----
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 67dddf3..fa257a7 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -1759,18 +1759,10 @@ rename (const char *oldpath, const char *newpath)
       set_errno (EROFS);
       goto out;
     }
-  if (new_dir_requested)
+  if (new_dir_requested && !(newpc.exists () ? newpc.isdir () : oldpc.isdir ()))
     {
-      if (!newpc.exists())
-        {
-          set_errno (ENOENT);
-          goto out;
-        }
-      if (!newpc.isdir ())
-        {
-          set_errno (ENOTDIR);
-          goto out;
-        }
+      set_errno (newpc.exists () ? ENOTDIR : ENOENT);
+      goto out;
     }
   if (newpc.exists () && (oldpc.isdir () ? !newpc.isdir () : newpc.isdir ()))
     {
-- 
1.6.5.rc1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]