Use O_CLOEXEC in sysconf [BZ #26791]

If sysconf is used in multithreaded processes, various filedescriptors
may leak due to missing O_CLOEXEC.  This commit adds the flag.
This commit is contained in:
Maximilian Krüger 2020-11-11 11:21:30 +01:00 committed by Arjun Shankar
parent 30af7c7fa1
commit d2d714b9fc
1 changed files with 1 additions and 1 deletions

View File

@ -81,7 +81,7 @@ __sysconf (int name)
if (procfname != NULL)
{
int fd = __open_nocancel (procfname, O_RDONLY);
int fd = __open_nocancel (procfname, O_RDONLY | O_CLOEXEC);
if (fd != -1)
{
/* This is more than enough, the file contains a single integer. */