mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 13:13:06 +00:00
Validates fd before calling fcntl
This commit is contained in:
committed by
David Goldblatt
parent
e215a7bc18
commit
aa6c282137
@@ -1414,7 +1414,9 @@ prof_open_maps(const char *format, ...) {
|
||||
mfd = open(filename, O_RDONLY | O_CLOEXEC);
|
||||
#else
|
||||
mfd = open(filename, O_RDONLY);
|
||||
fcntl(mfd, F_SETFD, fcntl(mfd, F_GETFD) | FD_CLOEXEC);
|
||||
if (mfd != -1) {
|
||||
fcntl(mfd, F_SETFD, fcntl(mfd, F_GETFD) | FD_CLOEXEC);
|
||||
}
|
||||
#endif
|
||||
|
||||
return mfd;
|
||||
|
||||
Reference in New Issue
Block a user