mirror of
https://git.savannah.gnu.org/git/make.git
synced 2024-12-28 15:57:48 +00:00
(getloadavg): Set FD_CLOEXEC flag on /dev/kmem file descriptor.
This commit is contained in:
parent
e74b6ae5c2
commit
8b3f13f6ec
1 changed files with 11 additions and 1 deletions
12
getloadavg.c
12
getloadavg.c
|
@ -840,7 +840,17 @@ getloadavg (loadavg, nelem)
|
|||
#ifndef SUNOS_5
|
||||
channel = open ("/dev/kmem", 0);
|
||||
if (channel >= 0)
|
||||
getloadavg_initialized = 1;
|
||||
{
|
||||
/* Set the channel to close on exec, so it does not
|
||||
litter any child's descriptor table. */
|
||||
#ifdef FD_SETFD
|
||||
#ifndef FD_CLOEXEC
|
||||
#define FD_CLOEXEC 1
|
||||
#endif
|
||||
(void) fcntl (channel, F_SETFD, FD_CLOEXEC);
|
||||
#endif
|
||||
getloadavg_initialized = 1;
|
||||
}
|
||||
#else /* SUNOS_5 */
|
||||
/* We pass 0 for the kernel, corefile, and swapfile names
|
||||
to use the currently running kernel. */
|
||||
|
|
Loading…
Reference in a new issue