diff options
author | Roland McGrath <roland@gnu.org> | 2004-07-13 00:23:34 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2004-07-13 00:23:34 +0000 |
commit | 69a64e9b471ebb456f2807c1cc04652167da154a (patch) | |
tree | 463188b4803fa0993e7a5d795369af70b217ed0a /sysdeps/unix | |
parent | 85fdc62bda73981c940d6a148a8571bc14a7e327 (diff) | |
download | glibc-69a64e9b471ebb456f2807c1cc04652167da154a.zip glibc-69a64e9b471ebb456f2807c1cc04652167da154a.tar.gz glibc-69a64e9b471ebb456f2807c1cc04652167da154a.tar.bz2 |
[BZ #263]
2004-07-12 Paul Eggert <eggert@cs.ucla.edu>
[BZ #263]
* sysdeps/unix/sysv/linux/getloadavg.c (getloadavg): Don't store
outside the buffer if the read returns 0. __strtod_l can't set
endp to NULL, so remove a test for that case.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r-- | sysdeps/unix/sysv/linux/getloadavg.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/getloadavg.c b/sysdeps/unix/sysv/linux/getloadavg.c index 6ef17fe..6a52143 100644 --- a/sysdeps/unix/sysv/linux/getloadavg.c +++ b/sysdeps/unix/sysv/linux/getloadavg.c @@ -45,7 +45,7 @@ getloadavg (double loadavg[], int nelem) nread = read_not_cancel (fd, buf, sizeof buf - 1); close_not_cancel_no_status (fd); - if (nread < 0) + if (nread <= 0) return -1; buf[nread - 1] = '\0'; @@ -56,7 +56,7 @@ getloadavg (double loadavg[], int nelem) { char *endp; loadavg[i] = __strtod_l (p, &endp, &_nl_C_locobj); - if (endp == NULL || endp == p) + if (endp == p) /* This should not happen. The format of /proc/loadavg must have changed. Don't return with what we have, signal an error. */ |