summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/getloadavg.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-02-11 16:34:21 +0000
committerUlrich Drepper <drepper@redhat.com>2001-02-11 16:34:21 +0000
commitb73c2df940474e6c2541f74bb09ea1fb19fd1410 (patch)
tree59de97ca613354fd876d908d28abb76e0a379dec /sysdeps/unix/sysv/linux/getloadavg.c
parent5a7eedfbe62cfbf1485dda60b350d3fb4867fedd (diff)
downloadglibc-b73c2df940474e6c2541f74bb09ea1fb19fd1410.tar.gz
glibc-b73c2df940474e6c2541f74bb09ea1fb19fd1410.tar.xz
glibc-b73c2df940474e6c2541f74bb09ea1fb19fd1410.zip
(getloadavg): Fail if we cannot return as many values as the user asked for.
Diffstat (limited to 'sysdeps/unix/sysv/linux/getloadavg.c')
-rw-r--r--sysdeps/unix/sysv/linux/getloadavg.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/getloadavg.c b/sysdeps/unix/sysv/linux/getloadavg.c
index 909920e6f7..b12db98f23 100644
--- a/sysdeps/unix/sysv/linux/getloadavg.c
+++ b/sysdeps/unix/sysv/linux/getloadavg.c
@@ -1,5 +1,5 @@
 /* Get system load averages.  Linux (/proc/loadavg) version.
-   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -55,7 +55,10 @@ getloadavg (double loadavg[], int nelem)
 	  char *endp;
 	  loadavg[i] = strtod (p, &endp);
 	  if (!endp || endp == p)
-	    break;
+	    /* This should not happen.  The format of /proc/loadavg
+	       must have changed.  Don't return with what we have,
+	       signal an error.  */
+	    return -1;
 	  p = endp;
 	}