]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Include unistd-safer.h.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 Apr 2005 20:02:28 +0000 (20:02 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 Apr 2005 20:02:28 +0000 (20:02 +0000)
(getloadavg): Use fd_safer.

lib/getloadavg.c

index 7732ddd0dbf6d234ddc1b2800a166921b0d312cc..b4b4e75178eb30a56c70cc400f5da3d9c8fdb6fd 100644 (file)
 # else
 #  include <sys/file.h>
 # endif
+
+# include "unistd-safer.h"
 \f
 /* 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