1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

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

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. */