mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-29 12:41:03 +00:00
Set CLOEXEC on epoll and regular file fds
This commit is contained in:
1 parent
fbc56f4adf
commit
ca4c2c6c41
3 files changed
+10
-8
No files matched your search
+2
-2
@@ -26,7 +26,7 @@ static int p_stat(const char *path, size_t *size, time_t *mtime) {
|
||||
FILE *fp = _wfopen(tmp, L"rb");
|
||||
if (fp != NULL) {
|
||||
fseek(fp, 0, SEEK_END);
|
||||
if (ftell(fp) > 0) st.st_size = ftell(fp); // Use _ftelli64 on win10+
|
||||
if (ftell(fp) > 0) st.st_size = ftell(fp); // Use _ftelli64 on win10+
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
@@ -166,7 +166,7 @@ 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 ? "rb" : "a+b";
|
||||
const char *mode = flags == MG_FS_READ ? "rbe" : "a+be"; // e for CLOEXEC
|
||||
#if MG_ARCH == MG_ARCH_WIN32
|
||||
wchar_t b1[MG_PATH_MAX], b2[10];
|
||||
MultiByteToWideChar(CP_UTF8, 0, path, -1, b1, sizeof(b1) / sizeof(b1[0]));
|
||||
|
||||
Reference in new issue
Block a user