Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mcelog: fix 'mcelog --client' blocked problem
I found this problem on my x86 box: $ mcelog --client Memory errors SOCKET 1 CHANNEL any DIMM any corrected memory errors: 660748032 total 660748032 in 24h uncorrected memory errors: 0 total 0 in 24h ... Per page corrected memory statistics: 1000: total 854944 seen "854944 in 24h" offline-failed triggered done <blocked here> I found the "done" command was split to two parts, so the client don't known when to quit. The strace result is bellow: $ strace -s 1024 mcelog --client ... read(4, " total 1 seen \"1 in 24h\" online\n\na0c75f000: total 1 seen \" 1 in 24h\" online\n\na0cdbe000: total 1 seen \"1 in 24h\" online\n\na0d2 e7000: total 1 seen \"1 in 24h\" online\n\na1a3cf000: total 1 seen \"1 in 24h\" online\n\na1d1ea000: total 1 seen \"1 in 24h\" online\n\na1d673000: ... 3f029000: total 1 seen \"1 in 24h\" online\n\ndo", 1024) = 1024 ^^ read(4, "ne\n", 1024) = 3 ^^^^ In this patch, I used fgets() to read one line string from server each time, instead of reading 1024 bytes with read(). v2: close fp before return [AK: Fixed warning] Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com> Reviewed-by: Sang Yan <sangyan@huawei.com> Signed-off-by: Andi Kleen <ak@linux.intel.com>
- Loading branch information