Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 70c4592b authored by Jing Ji's avatar Jing Ji
Browse files

Keep reading until end-of-file in reading procfs

As the pread(2) says "it is not an error for a successful call
to transfer fewer bytes than requested". The only way to verify
we're hitting the end-of-file is to keep reading from the file
until it returns 0. Here we're following this rule, in order to
make sure we read the whole procfs file to avoid the parser
errors. The drawback is that, now for every procfs read, it'll
have to hit the pread() at least twice. But if it has reached to
the end-of-file, the last read should return within microseconds.

Bug: 351917521
Flag: EXEMPT bugfix
Test: dumpsys cpuinfo
Change-Id: If6a14c4e8f4f1821628f1efb984f8064d4969a8c
parent 63465468
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment