aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/getloadavg.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/getloadavg.c b/src/getloadavg.c
index 8689a81eb50..5cf0b997bad 100644
--- a/src/getloadavg.c
+++ b/src/getloadavg.c
@@ -840,7 +840,17 @@ getloadavg (loadavg, nelem)
840#ifndef SUNOS_5 840#ifndef SUNOS_5
841 channel = open ("/dev/kmem", 0); 841 channel = open ("/dev/kmem", 0);
842 if (channel >= 0) 842 if (channel >= 0)
843 getloadavg_initialized = 1; 843 {
844 /* Set the channel to close on exec, so it does not
845 litter any child's descriptor table. */
846#ifdef FD_SETFD
847#ifndef FD_CLOEXEC
848#define FD_CLOEXEC 1
849#endif
850 (void) fcntl (channel, F_SETFD, FD_CLOEXEC);
851#endif
852 getloadavg_initialized = 1;
853 }
844#else /* SUNOS_5 */ 854#else /* SUNOS_5 */
845 /* We pass 0 for the kernel, corefile, and swapfile names 855 /* We pass 0 for the kernel, corefile, and swapfile names
846 to use the currently running kernel. */ 856 to use the currently running kernel. */