+2020-05-28 Bruno Haible <bruno@clisp.org>
+
+ get_ppid_of: Make more robust in multithreaded applications.
+ * lib/get_ppid_of.c (get_ppid_of): Pass an O_CLOEXEC flag to open().
+ * modules/get_ppid_of (Depends-on): Add 'open'.
+
2020-05-28 Bruno Haible <bruno@clisp.org>
get-rusage-as: Make more robust in multithreaded applications.
int fd;
sprintf (filename, "/proc/%u/status", (unsigned int) pid);
- fd = open (filename, O_RDONLY);
+ fd = open (filename, O_RDONLY | O_CLOEXEC);
if (fd >= 0)
{
char buf[4096 + 1];
int fd;
sprintf (filename, "/proc/%u/status", (unsigned int) pid);
- fd = open (filename, O_RDONLY);
+ fd = open (filename, O_RDONLY | O_CLOEXEC);
if (fd >= 0)
{
char buf[4096 + 1];
int fd;
sprintf (filename, "/proc/%u/psinfo", (unsigned int) pid);
- fd = open (filename, O_RDONLY);
+ fd = open (filename, O_RDONLY | O_CLOEXEC);
if (fd >= 0)
{
char buf[4096 + 1];
int fd;
sprintf (filename, "/proc/%u/psinfo", (unsigned int) pid);
- fd = open (filename, O_RDONLY);
+ fd = open (filename, O_RDONLY | O_CLOEXEC);
if (fd >= 0)
{
/* The contents is a 'struct psinfo'. But since 'struct psinfo'
int fd;
sprintf (filename, "/proc/pinfo/%u", pid);
- fd = open (filename, O_RDONLY);
+ fd = open (filename, O_RDONLY | O_CLOEXEC);
if (0 <= fd)
{
prpsinfo_t buf;