summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-05-27 20:04:38 +0200
committerBruno Haible <bruno@clisp.org>2020-05-28 21:40:10 +0200
commit60ab1089b542c78000ce310f849889b88a44efab (patch)
treec297c76d6cf12627d3e24be2f8e1c920e010314b
parentfb884731c692656b8147b22f9df3cd4f7b7631c0 (diff)
downloadgnulib-60ab1089b542c78000ce310f849889b88a44efab.tar.gz
at-internal: Make more robust in multithreaded applications.
* lib/openat-proc.c (openat_proc_name): Pass an O_CLOEXEC flag to open().
-rw-r--r--ChangeLog6
-rw-r--r--lib/openat-proc.c5
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 774183ea62..5b9bf6a81b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2020-05-28 Bruno Haible <bruno@clisp.org>
+ 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 <bruno@clisp.org>
+
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 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