diff options
author | Andreas Schwab <schwab@linux-m68k.org> | 2020-12-08 19:17:41 +0100 |
---|---|---|
committer | Andreas Schwab <schwab@linux-m68k.org> | 2020-12-09 15:32:29 +0100 |
commit | b5eeca8cfd9d0fd92b5633a88901d9ff27f2b496 (patch) | |
tree | 11dca6367cd37d4bdf48f5dd9e0a858dc79f51f2 /sysdeps/unix | |
parent | 224b419d1e750e3e9ced5c57774bb2bdd5292e28 (diff) | |
download | glibc-b5eeca8cfd9d0fd92b5633a88901d9ff27f2b496.tar.gz glibc-b5eeca8cfd9d0fd92b5633a88901d9ff27f2b496.tar.xz glibc-b5eeca8cfd9d0fd92b5633a88901d9ff27f2b496.zip |
Fix parsing of /sys/devices/system/cpu/online (bug 25859)
The file contains comma-separated ranges, not spaces.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r-- | sysdeps/unix/sysv/linux/getsysstats.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c index 1ef077f9af..a9069b7056 100644 --- a/sysdeps/unix/sysv/linux/getsysstats.c +++ b/sysdeps/unix/sysv/linux/getsysstats.c @@ -143,6 +143,7 @@ __get_nprocs (void) char *re = buffer_end; const int flags = O_RDONLY | O_CLOEXEC; + /* This file contains comma-separated ranges. */ int fd = __open_nocancel ("/sys/devices/system/cpu/online", flags); char *l; int result = 0; @@ -175,10 +176,10 @@ __get_nprocs (void) result += m - n + 1; l = endp; - while (l < re && isspace (*l)) + if (l < re && *l == ',') ++l; } - while (l < re); + while (l < re && *l != '\n'); __close_nocancel_nostatus (fd); |