Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
scaprile committed Sep 12, 2023
1 parent 7be4925 commit 42b9ac1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mongoose.c
Original file line number Diff line number Diff line change
Expand Up @@ -1144,13 +1144,14 @@ static void p_list(const char *dir, void (*fn)(const char *, void *),
}

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
const char *mode = flags == MG_FS_READ ? "rb" : "a+b";
wchar_t b1[MG_PATH_MAX], b2[10];
MultiByteToWideChar(CP_UTF8, 0, path, -1, b1, sizeof(b1) / sizeof(b1[0]));
MultiByteToWideChar(CP_UTF8, 0, mode, -1, b2, sizeof(b2) / sizeof(b2[0]));
return (void *) _wfopen(b1, b2);
#else
const char *mode = flags == MG_FS_READ ? "rbe" : "a+be"; // e for CLOEXEC
return (void *) fopen(path, mode);
#endif
}
Expand Down

0 comments on commit 42b9ac1

Please sign in to comment.