* lib/chown.c (rpl_chown): Pass an O_CLOEXEC flag to open().
+2020-05-28 Bruno Haible <bruno@clisp.org>
+
+ chown: Make more robust in multithreaded applications.
+ * lib/chown.c (rpl_chown): Pass an O_CLOEXEC flag to open().
+
2020-05-28 Bruno Haible <bruno@clisp.org>
doc: Fix statement about O_CLOEXEC (wrong since 2017-08-14).
on the symlink itself. To work around that, we open the
file (but this can fail due to lack of read or write permission) and
use fchown on the resulting descriptor. */
- int open_flags = O_NONBLOCK | O_NOCTTY;
+ int open_flags = O_NONBLOCK | O_NOCTTY | O_CLOEXEC;
int fd = open (file, O_RDONLY | open_flags);
if (0 <= fd
|| (errno == EACCES