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>2010-03-04 19:20:37 +0300
committerCorinna Vinschen <corinna@vinschen.de>2010-03-04 19:20:37 +0300
commit8e75995c7f0a612de4e0f54abde67e07535ed75e (patch)
tree406adf4f2e638dc9ff81663033b570b32081292b
parenta9fd74242880c6ec7d6f4697a722842e549b865d (diff)
* syscalls.cc (nt_path_has_executable_suffix): Change storage class of
blessed_executable_suffixes to static. (rename): Revert meaning of old_explicit_suffix. Change the rules for appending a .exe suffix and (yikes!) document them.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/syscalls.cc23
2 files changed, 23 insertions, 7 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 4eb11cbdd..205e4d57a 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2010-03-04 Corinna Vinschen <corinna@vinschen.de>
+
+ * syscalls.cc (nt_path_has_executable_suffix): Change storage class of
+ blessed_executable_suffixes to static.
+ (rename): Revert meaning of old_explicit_suffix. Change the rules
+ for appending a .exe suffix and (yikes!) document them.
+
2010-03-04 Charles Wilson <cygwin@cwilson.fastmail.fm>
* cygwin.din: Export __xdr functions.
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index d105f4e82..6f9260fcd 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -1688,7 +1688,7 @@ stop_transaction (NTSTATUS status, HANDLE old_trans, HANDLE trans)
static inline bool
nt_path_has_executable_suffix (PUNICODE_STRING upath)
{
- const PUNICODE_STRING blessed_executable_suffixes[] =
+ static const PUNICODE_STRING blessed_executable_suffixes[] =
{
&ro_u_com,
&ro_u_dll, /* Messy, messy. Per MSDN, the GetBinaryType function is
@@ -1820,10 +1820,9 @@ rename (const char *oldpath, const char *newpath)
set_errno (ENOTDIR);
goto out;
}
- if ((oldpc.known_suffix
+ if (oldpc.known_suffix
&& (ascii_strcasematch (oldpath + olen - 4, ".lnk")
|| ascii_strcasematch (oldpath + olen - 4, ".exe")))
- || nt_path_has_executable_suffix (oldpc.get_nt_native_path ()))
old_explicit_suffix = true;
nlen = strlen (newpath);
@@ -1931,9 +1930,14 @@ rename (const char *oldpath, const char *newpath)
&ro_u_lnk, TRUE))
rename_append_suffix (newpc, newpath, nlen, ".lnk");
else if (oldpc.is_binary () && !old_explicit_suffix
+ && oldpc.known_suffix
&& !nt_path_has_executable_suffix (newpc.get_nt_native_path ()))
- /* To rename an executable foo.exe to bar-without-suffix, the
- .exe suffix must be given explicitly in oldpath. */
+ /* Never append .exe suffix if oldpath had .exe suffix given
+ explicitely, or if oldpath wasn't already a .exe file, or
+ if the destination filename has one of the blessed executable
+ suffixes.
+ Note: To rename an executable foo.exe to bar-without-suffix,
+ the .exe suffix must be given explicitly in oldpath. */
rename_append_suffix (newpc, newpath, nlen, ".exe");
}
else
@@ -1961,8 +1965,13 @@ rename (const char *oldpath, const char *newpath)
}
else if (oldpc.is_binary ())
{
- /* Never append .exe suffix if file has any suffix already. */
- if (!nt_path_has_executable_suffix (newpc.get_nt_native_path ()))
+ /* 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
+ filename has one of the blessed executable suffixes. */
+ if (!old_explicit_suffix && oldpc.known_suffix
+ && !newpc.is_binary ()
+ && !nt_path_has_executable_suffix (newpc.get_nt_native_path ()))
{
rename_append_suffix (new2pc, newpath, nlen, ".exe");
removepc = &newpc;