mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-23 11:20:07 +00:00
[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.
This commit is contained in:
parent
85fdc62bda
commit
69a64e9b47
@ -1,3 +1,10 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2004-07-12 Roland McGrath <roland@redhat.com>
|
2004-07-12 Roland McGrath <roland@redhat.com>
|
||||||
|
|
||||||
* manual/signal.texi (Interrupted Primitives): Make clear that
|
* manual/signal.texi (Interrupted Primitives): Make clear that
|
||||||
|
@ -45,7 +45,7 @@ getloadavg (double loadavg[], int nelem)
|
|||||||
|
|
||||||
nread = read_not_cancel (fd, buf, sizeof buf - 1);
|
nread = read_not_cancel (fd, buf, sizeof buf - 1);
|
||||||
close_not_cancel_no_status (fd);
|
close_not_cancel_no_status (fd);
|
||||||
if (nread < 0)
|
if (nread <= 0)
|
||||||
return -1;
|
return -1;
|
||||||
buf[nread - 1] = '\0';
|
buf[nread - 1] = '\0';
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ getloadavg (double loadavg[], int nelem)
|
|||||||
{
|
{
|
||||||
char *endp;
|
char *endp;
|
||||||
loadavg[i] = __strtod_l (p, &endp, &_nl_C_locobj);
|
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
|
/* This should not happen. The format of /proc/loadavg
|
||||||
must have changed. Don't return with what we have,
|
must have changed. Don't return with what we have,
|
||||||
signal an error. */
|
signal an error. */
|
||||||
|
Loading…
Reference in New Issue
Block a user