]> Savannah Git Hosting - gnulib.git/commitdiff
openat: Make more robust in multithreaded applications.
authorBruno Haible <bruno@clisp.org>
Wed, 27 May 2020 18:06:37 +0000 (20:06 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 28 May 2020 19:40:12 +0000 (21:40 +0200)
* lib/openat.c (openat_needs_fchdir): Pass an O_CLOEXEC flag to open().

ChangeLog
lib/openat.c

index 5b9bf6a81bcce45e7a943ac798cffa5f59590880..7e30bf4dca653120d5ab7358f66fe6affef26283 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2020-05-28  Bruno Haible  <bruno@clisp.org>
+
+       openat: Make more robust in multithreaded applications.
+       * lib/openat.c (openat_needs_fchdir): Pass an O_CLOEXEC flag to open().
+
 2020-05-28  Bruno Haible  <bruno@clisp.org>
 
        at-internal: Make more robust in multithreaded applications.
index fbe1d2e6e605e48473b32d9d36050e1055981854..baf656621d8ef869f92d9c75f93c9e560b67d7a1 100644 (file)
@@ -291,7 +291,7 @@ bool
 openat_needs_fchdir (void)
 {
   bool needs_fchdir = true;
-  int fd = open ("/", O_SEARCH);
+  int fd = open ("/", O_SEARCH | O_CLOEXEC);
 
   if (0 <= fd)
     {