]> granicus.if.org Git - procps-ng/commit
library: become more tolerant of /proc/cpuinfo formats
authorJim Warner <james.warner@comcast.net>
Wed, 1 Mar 2023 06:00:00 +0000 (00:00 -0600)
committerCraig Small <csmall@dropbear.xyz>
Thu, 2 Mar 2023 08:38:41 +0000 (19:38 +1100)
commit133a833942224a9ae4cd049d62a3fa54e95c5a2a
treef8a8e1e15aef55de481aec5b2d13d5e4df70cb50
parent8c81808de09b034c5dc2221aacc85d25c3218676
library: become more tolerant of /proc/cpuinfo formats

In the issue referenced below, it is now apparent that
not all architectures follow a logical/expected format
for the /proc/cpuinfo file. Specifically, the expected
empty line after each processor entry might be missing
under some architectures for the last processor shown.

[ and a belated review of kernel source confirms it. ]

So this commit makes our stat module a little bit more
tolerant of some potential missing newline characters.

[ along the way, it's also now tolerant of a missing ]
[ cpuinfo file plus more efficient whenever a cpu is ]
[ is not linked to a core or toggled offline/online. ]

Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/272
procps-ng/procps#272

Signed-off-by: Jim Warner <james.warner@comcast.net>
library/stat.c