]> git.ipfire.org Git - thirdparty/glibc.git/commit
Use O_CLOEXEC in more places (BZ #15722)
authorSergey Bugaev <bugaevc@gmail.com>
Wed, 19 Apr 2023 16:02:03 +0000 (19:02 +0300)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sat, 22 Apr 2023 11:50:14 +0000 (13:50 +0200)
commit533deafbdf189f5fbb280c28562dd43ace2f4b0f
tree292d1cf07d52199a9dd247c6bb06f5566c218855
parent28a441cc577e31e95742b9ec5f1737b86749b712
Use O_CLOEXEC in more places (BZ #15722)

When opening a temporary file without O_CLOEXEC we risk leaking the
file descriptor if another thread calls (fork and then) exec while we
have the fd open. Fix this by consistently passing O_CLOEXEC everywhere
where we open a file for internal use (and not to return it to the user,
in which case the API defines whether or not the close-on-exec flag
shall be set on the returned fd).

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230419160207.65988-4-bugaevc@gmail.com>
catgets/open_catalog.c
elf/dl-profile.c
gmon/gmon.c
iconv/gconv_cache.c
login/utmp_file.c
sysdeps/pthread/sem_open.c