[PATCH] _bfd_real_fopen should not use ccs parameter on Windows

Yvan Roux yvan.roux@foss.st.com
Tue May 3 12:39:59 GMT 2022


Hi,

As it was discussed in https://sourceware.org/bugzilla/show_bug.cgi?id=25713
according to MSDN, the ccs=UNICODE should only be used when the encoding of the
file stream is supposed to be UTF-8 or UTF-16LE, and is not related to the
encoding of the file name.

Regression tested without any issue.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
Signed-off-by: Yvan ROUX <yvan.roux@foss.st.com>
---
 bfd/bfdio.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/bfd/bfdio.c b/bfd/bfdio.c
index 5c9a6555894..dc8d3916509 100644
--- a/bfd/bfdio.c
+++ b/bfd/bfdio.c
@@ -119,7 +119,6 @@ _bfd_real_fopen (const char *filename, const char *modes)
   /* PR 25713: Handle extra long path names possibly containing '..' and '.'.  */
    wchar_t **     lpFilePart = {NULL};
    const wchar_t  prefix[] = L"\\\\?\\";
-   const wchar_t  ccs[] = L", ccs=UNICODE";
    const size_t   partPathLen = strlen (filename) + 1;
 
    /* Converting the partial path from ascii to unicode.
@@ -151,10 +150,9 @@ _bfd_real_fopen (const char *filename, const char *modes)
    free (partPath);
 
    /* It is non-standard for modes to exceed 16 characters.  */
-   wchar_t    modesW[16 + sizeof(ccs)];
+   wchar_t    modesW[16];
 
    MultiByteToWideChar (CP_UTF8, 0, modes, -1, modesW, sizeof(modesW));
-   wcscat (modesW, ccs);
 
    FILE *     file = _wfopen (fullPath, modesW);
    free (fullPath);
-- 
2.17.1





More information about the Binutils mailing list