mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 07:05:28 +00:00
avoid a probable EINVAL from lseek
* src/qemu/qemu_driver.c (qemudLogReadFD): Don't pass a negative offset (from a preceding failed attempt to seek to EOF) to this use of lseek.
This commit is contained in:
parent
33e25a3984
commit
9344e6ad1a
@ -558,8 +558,8 @@ qemudLogReadFD(virConnectPtr conn, const char* logDir, const char* name, off_t p
|
|||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (lseek(fd, pos, SEEK_SET) < 0) {
|
if (pos < 0 || lseek(fd, pos, SEEK_SET) < 0) {
|
||||||
virReportSystemError(conn, errno,
|
virReportSystemError(conn, pos < 0 ? 0 : errno,
|
||||||
_("Unable to seek to %lld in %s"),
|
_("Unable to seek to %lld in %s"),
|
||||||
(long long) pos, logfile);
|
(long long) pos, logfile);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
Loading…
Reference in New Issue
Block a user