From: Paul Eggert Date: Mon, 11 Apr 2005 20:02:28 +0000 (+0000) Subject: Include unistd-safer.h. X-Git-Tag: CPPI-1_12~1046 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8bd8ca4bf3a6f1761d2d8a76fc7f89608bf474dd;p=thirdparty%2Fcoreutils.git Include unistd-safer.h. (getloadavg): Use fd_safer. --- diff --git a/lib/getloadavg.c b/lib/getloadavg.c index 7732ddd0db..b4b4e75178 100644 --- a/lib/getloadavg.c +++ b/lib/getloadavg.c @@ -452,6 +452,8 @@ # else # include # 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