32 #if defined(_WIN32) && !defined(__MINGW32CE__)
42 static int win32_open(
const char *filename_utf8,
int oflag,
int pmode)
48 if (utf8towchar(filename_utf8, &filename_w))
53 fd = _wsopen(filename_w, oflag, SH_DENYNO, pmode);
56 if (fd != -1 || (oflag & O_CREAT))
61 return _sopen(filename_utf8, oflag, SH_DENYNO, pmode);
63 #define open win32_open
69 unsigned int mode = 0;
74 mode = va_arg(ap,
unsigned int);
81 fd = open(filename, flags, mode);
84 if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
99 case 'r': access = O_RDONLY;
break;
100 case 'w': access = O_CREAT|O_WRONLY|O_TRUNC;
break;
101 case 'a': access = O_CREAT|O_WRONLY|O_APPEND;
break;
108 access &= ~(O_RDONLY | O_WRONLY);
110 }
else if (*m ==
'b') {
123 return fdopen(fd, mode);