parent
66813916b5
commit
10d090aae9
@ -353,12 +353,13 @@ os_overcommits_proc(void) {
|
|||||||
ssize_t nread;
|
ssize_t nread;
|
||||||
|
|
||||||
#if defined(JEMALLOC_USE_SYSCALL) && defined(SYS_open)
|
#if defined(JEMALLOC_USE_SYSCALL) && defined(SYS_open)
|
||||||
fd = (int)syscall(SYS_open, "/proc/sys/vm/overcommit_memory", O_RDONLY);
|
fd = (int)syscall(SYS_open, "/proc/sys/vm/overcommit_memory", O_RDONLY |
|
||||||
|
O_CLOEXEC);
|
||||||
#elif defined(JEMALLOC_USE_SYSCALL) && defined(SYS_openat)
|
#elif defined(JEMALLOC_USE_SYSCALL) && defined(SYS_openat)
|
||||||
fd = (int)syscall(SYS_openat,
|
fd = (int)syscall(SYS_openat,
|
||||||
AT_FDCWD, "/proc/sys/vm/overcommit_memory", O_RDONLY);
|
AT_FDCWD, "/proc/sys/vm/overcommit_memory", O_RDONLY | O_CLOEXEC);
|
||||||
#else
|
#else
|
||||||
fd = open("/proc/sys/vm/overcommit_memory", O_RDONLY);
|
fd = open("/proc/sys/vm/overcommit_memory", O_RDONLY | O_CLOEXEC);
|
||||||
#endif
|
#endif
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
return false; /* Error. */
|
return false; /* Error. */
|
||||||
|
@ -1409,7 +1409,7 @@ prof_open_maps(const char *format, ...) {
|
|||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
malloc_vsnprintf(filename, sizeof(filename), format, ap);
|
malloc_vsnprintf(filename, sizeof(filename), format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
mfd = open(filename, O_RDONLY);
|
mfd = open(filename, O_RDONLY | O_CLOEXEC);
|
||||||
|
|
||||||
return mfd;
|
return mfd;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user