summaryrefslogtreecommitdiffstats
path: root/gl/getloadavg.c
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2009-05-20 00:32:10 +0200
committerHolger Weiss <holger@zedat.fu-berlin.de>2009-05-20 00:32:10 +0200
commit50b3ff7b91e78a61aca93247bee586d6d7eb27c8 (patch)
treedb4c7eee24479ac7ee6888ce1562facf60159b71 /gl/getloadavg.c
parent2701ccd500e60537a8c2977a81549ff33eeaef3f (diff)
downloadmonitoring-plugins-50b3ff7b91e78a61aca93247bee586d6d7eb27c8.tar.gz
Sync with the latest Gnulib code (cb75dc5)
Signed-off-by: Holger Weiss <holger@zedat.fu-berlin.de>
Diffstat (limited to 'gl/getloadavg.c')
-rw-r--r--gl/getloadavg.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gl/getloadavg.c b/gl/getloadavg.c
index 5c32f9f9..5a4005ce 100644
--- a/gl/getloadavg.c
+++ b/gl/getloadavg.c
@@ -1,8 +1,8 @@
1/* Get the system load averages. 1/* Get the system load averages.
2 2
3 Copyright (C) 1985, 1986, 1987, 1988, 1989, 1991, 1992, 1993, 1994, 3 Copyright (C) 1985, 1986, 1987, 1988, 1989, 1991, 1992, 1993, 1994,
4 1995, 1997, 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2008 Free Software 4 1995, 1997, 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free
5 Foundation, Inc. 5 Software Foundation, Inc.
6 6
7 NOTE: The canonical source of this file is maintained with gnulib. 7 NOTE: The canonical source of this file is maintained with gnulib.
8 Bugs can be reported to bug-gnulib@gnu.org. 8 Bugs can be reported to bug-gnulib@gnu.org.
@@ -621,8 +621,11 @@ getloadavg (double loadavg[], int nelem)
621 for (elem = 0; elem < nelem; elem++) 621 for (elem = 0; elem < nelem; elem++)
622 { 622 {
623 char *endptr; 623 char *endptr;
624 double d = c_strtod (ptr, &endptr); 624 double d;
625 if (ptr == endptr) 625
626 errno = 0;
627 d = c_strtod (ptr, &endptr);
628 if (ptr == endptr || (d == 0 && errno != 0))
626 { 629 {
627 if (elem == 0) 630 if (elem == 0)
628 return -1; 631 return -1;