mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-18 23:12:15 +08:00
* 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.
This commit is contained in:
parent
a9fd742428
commit
8e75995c7f
@ -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.
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user