summaryrefslogtreecommitdiff
path: root/lib/mountlist.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-05-27 20:02:57 +0200
committerBruno Haible <bruno@clisp.org>2020-05-28 21:40:08 +0200
commitfb884731c692656b8147b22f9df3cd4f7b7631c0 (patch)
treeff16d93a5c2fdb68ceb6d4637010269464303bdc /lib/mountlist.c
parent968988975696de692623bbde066d9048dc02d828 (diff)
downloadgnulib-fb884731c692656b8147b22f9df3cd4f7b7631c0.tar.gz
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'.
Diffstat (limited to 'lib/mountlist.c')
-rw-r--r--lib/mountlist.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/mountlist.c b/lib/mountlist.c
index 4cb19c87f1..9cf78c82e0 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -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;