fix: handle EINTR correctly in get_cpu_mask_from_sysfs stable-2.13
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 2 May 2024 14:41:49 +0000 (10:41 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 2 May 2024 14:45:35 +0000 (10:45 -0400)
commit29606003df229b21a9059f8d69ec8c5a9b479dff
treec8c411f63418b91860215be5a387b8f1bc59aba5
parent5a8c530cec95b827a4840c0d032b502f82f0dde3
fix: handle EINTR correctly in get_cpu_mask_from_sysfs

If the read() in get_cpu_mask_from_sysfs() fails with EINTR, the code is
supposed to retry, but the while loop condition has (bytes_read > 0),
which is false when read() fails with EINTR. The result is that the code
exits the loop, having only read part of the string.

Use (bytes_read != 0) in the while loop condition instead, since the
(bytes_read < 0) case is already handled in the loop.

Original fix in liburcu from Benjamin Marzinski <bmarzins@redhat.com>:

  commit 9922f33e2986 ("fix: handle EINTR correctly in get_cpu_mask_from_sysfs")

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I885a0fb98e5a7cfb9a8bd180c8e64b20926ff58c
src/common/smp.c
This page took 0.025713 seconds and 4 git commands to generate.