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

ChangeLog
lib/openat-proc.c

index 774183ea62f6f22b24309c53d7a18e12fc768a5d..5b9bf6a81bcce45e7a943ac798cffa5f59590880 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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.
index 9111cd3d7eedfe6ece5c6cfcf718937953deebaf..b5aaee8b1d36ec688039c6b651510002e28279a3 100644 (file)
@@ -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