From: Bruno Haible Date: Wed, 27 May 2020 18:06:37 +0000 (+0200) Subject: openat: Make more robust in multithreaded applications. X-Git-Tag: v1.0~4037 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=b6b450b61ee404f19903a5e2e127c249e5c46d78;p=gnulib.git openat: Make more robust in multithreaded applications. * lib/openat.c (openat_needs_fchdir): Pass an O_CLOEXEC flag to open(). --- 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) {