1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

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: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik 2016-03-31 16:43:08 +02:00
parent b508a4f15f
commit 2cbdd64adf

View File

@ -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;