From: Bruno Haible Date: Wed, 27 May 2020 18:04:38 +0000 (+0200) Subject: at-internal: Make more robust in multithreaded applications. X-Git-Tag: v1.0~4038 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=60ab1089b542c78000ce310f849889b88a44efab;p=gnulib.git at-internal: Make more robust in multithreaded applications. * lib/openat-proc.c (openat_proc_name): Pass an O_CLOEXEC flag to open(). --- diff --git a/ChangeLog b/ChangeLog index 774183ea62..5b9bf6a81b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2020-05-28 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-28 Bruno Haible mountlist: Make more robust in multithreaded applications. diff --git a/lib/openat-proc.c b/lib/openat-proc.c index 9111cd3d7e..b5aaee8b1d 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