diff options
author | Maximilian Krüger <max@maxfragg.de> | 2020-11-11 11:21:30 +0100 |
---|---|---|
committer | Arjun Shankar <arjun@redhat.com> | 2020-11-11 12:15:21 +0100 |
commit | d2d714b9fc02e4710d6dc769d8ec2c9dab0eb69a (patch) | |
tree | cc46d9f842a1cbec9e00a6bf1d911fc2f32ad448 /sysdeps/unix/sysv | |
parent | 30af7c7fa13e17d82c3f1f91536384715844f432 (diff) | |
download | glibc-d2d714b9fc02e4710d6dc769d8ec2c9dab0eb69a.zip glibc-d2d714b9fc02e4710d6dc769d8ec2c9dab0eb69a.tar.gz glibc-d2d714b9fc02e4710d6dc769d8ec2c9dab0eb69a.tar.bz2 |
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.
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r-- | sysdeps/unix/sysv/linux/sysconf.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/sysconf.c b/sysdeps/unix/sysv/linux/sysconf.c index 7958a74..9c5a4cb 100644 --- a/sysdeps/unix/sysv/linux/sysconf.c +++ b/sysdeps/unix/sysv/linux/sysconf.c @@ -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. */ |