]> sourceware.org Git - glibc.git/commitdiff
(getloadavg): Fail if we cannot return as many values as the user asked for.
authorUlrich Drepper <drepper@redhat.com>
Sun, 11 Feb 2001 16:34:21 +0000 (16:34 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sun, 11 Feb 2001 16:34:21 +0000 (16:34 +0000)
sysdeps/unix/sysv/linux/getloadavg.c

index 909920e6f75c4545a49a97c0400aea1607a4d723..b12db98f23677d41a031756c7d99720a93206151 100644 (file)
@@ -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;
        }
 
This page took 0.067275 seconds and 5 git commands to generate.