mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-28 12:05:47 +08:00
While filenames on NFS shares are converted internally to a widechar representation of the input bytes treated as the default system ANSI codepage (CP_ACP), this doesn't hold for share names. The names returned by WNetEnumResourceW are just the original bytes dropped verbatim into WCHAR. The original conversion from 7db1c6fc4e2a ("Cygwin: //server: revert to using WNet and support NFS shares") was erroneous in that it treated the bytes as ISO-8859-1, not as CP_ACP codepoints. Fix the conversion to convert from CP_ACP to widechar. Use a tmp_pathbuf buffer for the new widechar string instead of malloc/free. Extend the comment, better explaining the encoding difference between files and shares. Fixes: 7db1c6fc4e2a ("Cygwin: //server: revert to using WNet and support NFS shares") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>