>From bbafdbca04ecb68d90b181d1760f234e8f12044e Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 27 May 2020 20:04:38 +0200 Subject: [PATCH 12/18] at-internal: Make more robust in multithreaded applications. * lib/openat-proc.c (openat_proc_name): Pass an O_CLOEXEC flag to open(). --- ChangeLog | 6 ++++++ lib/openat-proc.c | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a840c8e..e5460c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2020-05-27 Bruno Haible + at-internal: Make more robust in multithreaded applications. + * lib/openat-proc.c (openat_proc_name): Pass an O_CLOEXEC flag to + open(). + +2020-05-27 Bruno Haible + mountlist: Make more robust in multithreaded applications. * lib/mountlist.c (read_file_system_list): Pass an O_CLOEXEC flag to open(). diff --git a/lib/openat-proc.c b/lib/openat-proc.c index 9111cd3..b5aaee8 100644 --- a/lib/openat-proc.c +++ b/lib/openat-proc.c @@ -73,8 +73,9 @@ openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const *file) problem is exhibited on code that built on Solaris 8 and running on Solaris 10. */ - int proc_self_fd = open ("/proc/self/fd", - O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK); + int proc_self_fd = + open ("/proc/self/fd", + O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK | O_CLOEXEC); if (proc_self_fd < 0) proc_status = -1; else -- 2.7.4