From b6b450b61ee404f19903a5e2e127c249e5c46d78 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 27 May 2020 20:06:37 +0200 Subject: [PATCH] openat: Make more robust in multithreaded applications. * lib/openat.c (openat_needs_fchdir): Pass an O_CLOEXEC flag to open(). --- ChangeLog | 5 +++++ lib/openat.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5b9bf6a81b..7e30bf4dca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2020-05-28 Bruno Haible + + 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 at-internal: Make more robust in multithreaded applications. diff --git a/lib/openat.c b/lib/openat.c index fbe1d2e6e6..baf656621d 100644 --- a/lib/openat.c +++ b/lib/openat.c @@ -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) { -- 2.39.5