summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/getloadavg.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/getloadavg.c b/lib/getloadavg.c
index 7732ddd0d..b4b4e7517 100644
--- a/lib/getloadavg.c
+++ b/lib/getloadavg.c
@@ -452,6 +452,8 @@
# else
# include <sys/file.h>
# endif
+
+# include "unistd-safer.h"
/* Avoid static vars inside a function since in HPUX they dump as pure. */
@@ -911,7 +913,7 @@ getloadavg (double loadavg[], int nelem)
if (!getloadavg_initialized)
{
# ifndef SUNOS_5
- channel = open ("/dev/kmem", 0);
+ channel = fd_safer (open ("/dev/kmem", O_RDONLY));
if (channel >= 0)
{
/* Set the channel to close on exec, so it does not