OSDN Git Service

* syscalls.cc (rename): If newpath doesn't exist, check if .exe suffix
authorcorinna <corinna>
Mon, 11 Aug 2008 15:05:24 +0000 (15:05 +0000)
committercorinna <corinna>
Mon, 11 Aug 2008 15:05:24 +0000 (15:05 +0000)
in oldpath has been omitted before appending .exe to newpath.

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

index 4527099..e319b44 100644 (file)
@@ -1,3 +1,8 @@
+2008-08-11  Corinna Vinschen  <corinna@vinschen.de>
+
+       * syscalls.cc (rename): If newpath doesn't exist, check if .exe suffix
+       in oldpath has been omitted before appending .exe to newpath.
+
 2008-08-09  Corinna Vinschen  <corinna@vinschen.de>
 
        * fhandler_floppy.cc (fhandler_dev_floppy::raw_read): Don't set
index 92446bc..7801ea2 100644 (file)
@@ -1656,10 +1656,11 @@ rename (const char *oldpath, const char *newpath)
               && !RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (),
                                              L".lnk", TRUE))
        rename_append_suffix (newpc, newpath, nlen, ".lnk");
-      else if (oldpc.is_binary ()
+      else if (oldpc.is_binary () && !old_explicit_suffix
           && !RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (),
                                          L".exe", TRUE))
-       /* NOTE: No way to rename an executable foo.exe to foo. */
+       /* To rename an executable foo.exe to bar-without-exe-suffix, the
+          .exe suffix must be given explicitly in oldpath. */
        rename_append_suffix (newpc, newpath, nlen, ".exe");
     }
   else if (newpc.isdir ())