]> Savannah Git Hosting - gnulib.git/commitdiff
mountlist: Make more robust in multithreaded applications.
authorBruno Haible <bruno@clisp.org>
Wed, 27 May 2020 18:02:57 +0000 (20:02 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 28 May 2020 19:40:08 +0000 (21:40 +0200)
* lib/mountlist.c (read_file_system_list): Pass an O_CLOEXEC flag to
open().
* modules/mountlist (Depends-on): Add 'open'.

ChangeLog
lib/mountlist.c
modules/mountlist

index b034e30a6a4d5ebc72cf4b8581458e95335500eb..774183ea62f6f22b24309c53d7a18e12fc768a5d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+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().
+       * modules/mountlist (Depends-on): Add 'open'.
+
 2020-05-28  Bruno Haible  <bruno@clisp.org>
 
        login_tty: Make more robust in multithreaded applications.
index 4cb19c87f1291bdb9459ebbc9354a8f8aa42ce66..9cf78c82e00474072f81c72b87f318da0bada1c6 100644 (file)
@@ -902,7 +902,7 @@ read_file_system_list (bool need_fs_type)
 #  ifndef MNTTAB_LOCK
 #   define MNTTAB_LOCK "/etc/.mnttab.lock"
 #  endif
-    lockfd = open (MNTTAB_LOCK, O_RDONLY);
+    lockfd = open (MNTTAB_LOCK, O_RDONLY | O_CLOEXEC);
     if (0 <= lockfd)
       {
         struct flock flock;
index 5bb45edf6485d68a041166a718604c67107dc572..7542048e451a396dc492abbc1fc05fed3ddac025 100644 (file)
@@ -10,6 +10,7 @@ m4/mountlist.m4
 Depends-on:
 fopen-gnu
 getline
+open
 stdbool
 stdint
 strstr-simple