Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2011-12-19 21:01:37 +0400
committerCorinna Vinschen <corinna@vinschen.de>2011-12-19 21:01:37 +0400
commit18d0c0fb8b040e9fa16d8ea57d37516e815f368a (patch)
tree82ddf5d14b0878d284c9d521c3b1f887fa279e17 /winsup/cygwin/syscalls.cc
parenta48970970e326c3c367193506aa6f9f76f11586f (diff)
* syscalls.cc (rename): Fix typo in comment. Fix condition to handle
the case oldpath is no .lnk symlink and newpath points to an existing .lnk symlink or .exe file and no explicit .lnk suffix has been given in oldpath. Add a comment to explain.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index f86e0442a..e96116e84 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -2162,7 +2162,7 @@ rename (const char *oldpath, const char *newpath)
{
/* Never append .exe suffix if oldpath had .exe suffix given
explicitely, or if newfile is a binary (in which case the given
- name probably makes sesne as it is), or if the destination
+ name probably makes sense as it is), or if the destination
filename has one of the blessed executable suffixes. */
if (!old_explicit_suffix && oldpc.known_suffix
&& !newpc.is_binary ()
@@ -2174,8 +2174,12 @@ rename (const char *oldpath, const char *newpath)
}
else
{
- if ((RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (),
- &ro_u_lnk, TRUE)
+ /* If the new path is an existing .lnk symlink or a .exe file,
+ but the new path has not been specified with explicit suffix,
+ rename to the new name without suffix, as expected, but also
+ remove the clashing symlink or executable. Did I ever mention
+ how I hate the file suffix idea? */
+ if ((newpc.is_lnk_special ()
|| RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (),
&ro_u_exe, TRUE))
&& !new_explicit_suffix)