提交 2cbdd64a 编写于 作者: M Michal Privoznik

virPerfReadEvent: Prefer saferead over read

Do I really need to explain why?
Well, if read() is interrupted int the middle of reading, we will
never read the rest (even though it's highly unlikely as we are
reading just 8 bytes).
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 b508a4f1
......@@ -247,7 +247,7 @@ virPerfReadEvent(virPerfPtr perf,
if (event == NULL || !event->enabled)
return -1;
if (read(event->fd, value, sizeof(uint64_t)) < 0) {
if (saferead(event->fd, value, sizeof(uint64_t)) < 0) {
virReportSystemError(errno, "%s",
_("Unable to read cache data"));
return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册