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
This commit is contained in:
Erik Skultety 2015-03-03 16:57:38 +01:00 committed by Peter Krempa
parent d9c7f014ee
commit 3fde7986d6

View File

@ -610,7 +610,7 @@ virFDStreamOpenFileInternal(virStreamPtr st,
}
if (offset &&
lseek(fd, offset, SEEK_SET) != offset) {
lseek(fd, offset, SEEK_SET) < 0) {
virReportSystemError(errno,
_("Unable to seek %s to %llu"),
path, offset);