We don't want to leak descriptors to child PROCESSES (!= threads) such
as the pseudo-CGI interface. The socket wrappers ahve already been doing
that for a while. Unfortunately, there are still many "leaks", through
underlying libraries, opendir(), fopen(), etc. And then, this is not
thread-safe (we leak if another thread calls fork() between open() and
fcntl()). This is a well-known limitation in POSIX anyway.
_("VLC could not open the file \"%s\"."), path);
return -1;
}
+ fcntl (fd, F_SETFD, fcntl (fd, F_GETFD) | FD_CLOEXEC);
#if defined(HAVE_FCNTL_H)
/* We'd rather use any available memory for reading ahead
msg_Warn (p_access, "cannot open %s: %m", path);
goto error;
}
+ fcntl (fd, F_SETFD, fcntl (fd, F_GETFD) | FD_CLOEXEC);
/* mmap() is only safe for regular and block special files.
* For other types, it may be some idiosyncrasic interface (e.g. packet