提交 a6be5a4c 编写于 作者: M Michal Privoznik

virRandomBytes: Prefer saferead over plain read

Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 c3320d65
......@@ -182,9 +182,7 @@ virRandomBytes(unsigned char *buf,
while (buflen > 0) {
ssize_t n;
if ((n = read(fd, buf, buflen)) <= 0) {
if (errno == EINTR)
continue;
if ((n = saferead(fd, buf, buflen)) <= 0) {
VIR_FORCE_CLOSE(fd);
return n < 0 ? -errno : -ENODATA;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册