mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-11 16:40:17 +00:00
Do not use CLOEXEC on Windows
This commit is contained in:
1 parent
8f56779855
commit
7b19568683
1 file changed
+2
-1
+2
-1
@@ -166,13 +166,14 @@ static void p_list(const char *dir, void (*fn)(const char *, void *),
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *p_open(const char *path, int flags) {
|
static void *p_open(const char *path, int flags) {
|
||||||
const char *mode = flags == MG_FS_READ ? "rbe" : "a+be"; // e for CLOEXEC
|
|
||||||
#if MG_ARCH == MG_ARCH_WIN32
|
#if MG_ARCH == MG_ARCH_WIN32
|
||||||
|
const char *mode = flags == MG_FS_READ ? "rb" : "a+b";
|
||||||
wchar_t b1[MG_PATH_MAX], b2[10];
|
wchar_t b1[MG_PATH_MAX], b2[10];
|
||||||
MultiByteToWideChar(CP_UTF8, 0, path, -1, b1, sizeof(b1) / sizeof(b1[0]));
|
MultiByteToWideChar(CP_UTF8, 0, path, -1, b1, sizeof(b1) / sizeof(b1[0]));
|
||||||
MultiByteToWideChar(CP_UTF8, 0, mode, -1, b2, sizeof(b2) / sizeof(b2[0]));
|
MultiByteToWideChar(CP_UTF8, 0, mode, -1, b2, sizeof(b2) / sizeof(b2[0]));
|
||||||
return (void *) _wfopen(b1, b2);
|
return (void *) _wfopen(b1, b2);
|
||||||
#else
|
#else
|
||||||
|
const char *mode = flags == MG_FS_READ ? "rbe" : "a+be"; // e for CLOEXEC
|
||||||
return (void *) fopen(path, mode);
|
return (void *) fopen(path, mode);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user