projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
stdlib: sort witness names
[gnulib.git]
/
lib
/
getloadavg.c
diff --git
a/lib/getloadavg.c
b/lib/getloadavg.c
index
5c32f9f
..
a7bac49
100644
(file)
--- a/
lib/getloadavg.c
+++ b/
lib/getloadavg.c
@@
-1,8
+1,8
@@
/* Get the system load averages.
Copyright (C) 1985, 1986, 1987, 1988, 1989, 1991, 1992, 1993, 1994,
/* Get the system load averages.
Copyright (C) 1985, 1986, 1987, 1988, 1989, 1991, 1992, 1993, 1994,
- 1995, 1997, 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2008
Free Softwar
e
- Foundation, Inc.
+ 1995, 1997, 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2008
, 2009 Fre
e
+
Software
Foundation, Inc.
NOTE: The canonical source of this file is maintained with gnulib.
Bugs can be reported to bug-gnulib@gnu.org.
NOTE: The canonical source of this file is maintained with gnulib.
Bugs can be reported to bug-gnulib@gnu.org.
@@
-44,8
+44,8
@@
otherwise, no load average is available.
HAVE_NLIST_H nlist.h is available. NLIST_STRUCT defaults
to this.
otherwise, no load average is available.
HAVE_NLIST_H nlist.h is available. NLIST_STRUCT defaults
to this.
- NLIST_STRUCT Include nlist.h, not a.out.h
, and
-
t
he nlist n_name element is a pointer,
+ NLIST_STRUCT Include nlist.h, not a.out.h
.
+
N_NAME_POINTER T
he nlist n_name element is a pointer,
not an array.
HAVE_STRUCT_NLIST_N_UN_N_NAME `n_un.n_name' is member of `struct nlist'.
LINUX_LDAV_FILE [__linux__, __CYGWIN__]: File containing
not an array.
HAVE_STRUCT_NLIST_N_UN_N_NAME `n_un.n_name' is member of `struct nlist'.
LINUX_LDAV_FILE [__linux__, __CYGWIN__]: File containing
@@
-621,8
+621,11
@@
getloadavg (double loadavg[], int nelem)
for (elem = 0; elem < nelem; elem++)
{
char *endptr;
for (elem = 0; elem < nelem; elem++)
{
char *endptr;
- double d = c_strtod (ptr, &endptr);
- if (ptr == endptr)
+ double d;
+
+ errno = 0;
+ d = c_strtod (ptr, &endptr);
+ if (ptr == endptr || (d == 0 && errno != 0))
{
if (elem == 0)
return -1;
{
if (elem == 0)
return -1;
@@
-897,7
+900,7
@@
getloadavg (double loadavg[], int nelem)
if (offset == 0)
{
# ifndef sgi
if (offset == 0)
{
# ifndef sgi
-# if
ndef NLIST_STRUCT
+# if
! defined NLIST_STRUCT || ! defined N_NAME_POINTER
strcpy (nl[0].n_name, LDAV_SYMBOL);
strcpy (nl[1].n_name, "");
# else /* NLIST_STRUCT */
strcpy (nl[0].n_name, LDAV_SYMBOL);
strcpy (nl[1].n_name, "");
# else /* NLIST_STRUCT */