Re: [PATCH I18N filenames v2 3/3] Provide compatibility with MinGW

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

Timur Sufiev:

diff --git a/compat/mingw.c b/compat/mingw.c
index 6b5b5b2..2a2ebcb 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -2,7 +2,7 @@
#include "win32.h"
#include <conio.h>
#include "../strbuf.h"
-
+#include "../io-i18n.h"
#include <shellapi.h>

static int err_win_to_posix(DWORD winerr)
@@ -132,7 +132,7 @@ int mingw_open (const char *filename, int oflags, ...)
	if (!strcmp(filename, "/dev/null"))
		filename = "nul";

-	fd = open(filename, oflags, mode);
+	fd = open_i18n(filename, oflags, mode);

	if (fd < 0 && (oflags & O_CREAT) && errno == EACCES) {
		DWORD attrs = GetFileAttributes(filename);

Instead of calling the open_i18n() which converts from UTF-8 to a local 8-bit character set, this should probably call a version that converts from UTF-8 to UTF-16 and uses _wopen().

Same thing for fopen_i18n() and _wfopen().

I created a small RFC patch for that that changed parts of the system earlier this year - http://kerneltrap.org/mailarchive/git/2009/3/2/5350814

I did not address readdir() and friends, I'm not sure if they are available in UTF-16 form or if they need to be rewritten using findfirst()/findnext().

--
\\// Peter - http://www.softwolves.pp.se/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]