提交 3fde7986 编写于 作者: E Erik Skultety 提交者: Peter Krempa

storage: tweak condition to properly test lseek

According to the POSIX standard, off_t (returned by lseek) is defined as
signed integral type no shorter than int. Because our offset variable is defined
as unsigned long long, the original check was passed successfully if UINT64_MAX had
been used as offset value, due to implicit conversion.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1177219
上级 d9c7f014
...@@ -610,7 +610,7 @@ virFDStreamOpenFileInternal(virStreamPtr st, ...@@ -610,7 +610,7 @@ virFDStreamOpenFileInternal(virStreamPtr st,
} }
if (offset && if (offset &&
lseek(fd, offset, SEEK_SET) != offset) { lseek(fd, offset, SEEK_SET) < 0) {
virReportSystemError(errno, virReportSystemError(errno,
_("Unable to seek %s to %llu"), _("Unable to seek %s to %llu"),
path, offset); path, offset);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册