projects
/
platform
/
upstream
/
glibc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
224b419
)
Fix parsing of /sys/devices/system/cpu/online (bug 25859)
author
Andreas Schwab
<schwab@linux-m68k.org>
Tue, 8 Dec 2020 18:17:41 +0000
(19:17 +0100)
committer
Andreas Schwab
<schwab@linux-m68k.org>
Wed, 9 Dec 2020 14:32:29 +0000
(15:32 +0100)
The file contains comma-separated ranges, not spaces.
sysdeps/unix/sysv/linux/getsysstats.c
patch
|
blob
|
history
diff --git
a/sysdeps/unix/sysv/linux/getsysstats.c
b/sysdeps/unix/sysv/linux/getsysstats.c
index
1ef077f
..
a9069b7
100644
(file)
--- 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);