diff options
author | Jim Meyering <jim@meyering.net> | 2004-03-03 22:06:47 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2004-03-03 22:06:47 +0000 |
commit | e819dd0dd9c2b76a57c78944c4835a7a3ea5ccfe (patch) | |
tree | b53980cde9933f5bb6bb8032b16aa770bce76480 | |
parent | a81ffe3b275afcd62db1817f9c72e49eca9b2d8a (diff) | |
download | coreutils-e819dd0dd9c2b76a57c78944c4835a7a3ea5ccfe.tar.xz |
Include "cloexec.h".
(getloadavg): Use set_cloexec_flag instead of manual fcntl call.
-rw-r--r-- | lib/getloadavg.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/getloadavg.c b/lib/getloadavg.c index 6ac0a8c5d..01aa87858 100644 --- a/lib/getloadavg.c +++ b/lib/getloadavg.c @@ -1,7 +1,7 @@ /* Get the system load averages. Copyright (C) 1985, 1986, 1987, 1988, 1989, 1991, 1992, 1993, 1994, - 1995, 1997, 1999, 2000, 2003 Free Software Foundation, Inc. + 1995, 1997, 1999, 2000, 2003, 2004 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with gnulib. Bugs can be reported to bug-gnulib@gnu.org. @@ -114,6 +114,8 @@ extern int errno; # define setlocale(Category, Locale) /* empty */ #endif +#include "cloexec.h" + #ifndef HAVE_GETLOADAVG /* The existing Emacs configuration files define a macro called @@ -924,12 +926,7 @@ getloadavg (double loadavg[], int nelem) { /* Set the channel to close on exec, so it does not litter any child's descriptor table. */ -# ifdef F_SETFD -# ifndef FD_CLOEXEC -# define FD_CLOEXEC 1 -# endif - (void) fcntl (channel, F_SETFD, FD_CLOEXEC); -# endif + set_cloexec_flag (channel, 1) getloadavg_initialized = 1; } # else /* SUNOS_5 */ |