Use lseek+saferead/write for pci.c & dont link to qemu driver for nodedevxml2xmltest

This commit is contained in:
Daniel P. Berrange 2009-03-03 17:00:18 +00:00
parent 61796bdb4b
commit 3aed672836
3 changed files with 13 additions and 3 deletions

View File

@ -1,3 +1,11 @@
Tue Mar 3 16:55:13 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
Mingw32 portability fixes
* src/pci.c: Use lseek+read/write instead of pread/pwrite
to avoid mingw compile break
* test/nodedevxml2xmltest.c: Don't link to QEMU driver, since
its not required and breaks build when QEMU is turned off
Tue Mar 3 16:43:13 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
Explicitly track static declared vs dynamically generated

View File

@ -156,7 +156,8 @@ pciRead(pciDevice *dev, unsigned pos, uint8_t *buf, unsigned buflen)
if (pciOpenConfig(dev) < 0)
return -1;
if (pread(dev->fd, buf, buflen, pos) < 0) {
if (lseek(dev->fd, pos, SEEK_SET) != pos ||
saferead(dev->fd, buf, buflen) != buflen) {
char ebuf[1024];
VIR_WARN(_("Failed to read from '%s' : %s"), dev->path,
virStrerror(errno, ebuf, sizeof(ebuf)));
@ -195,7 +196,8 @@ pciWrite(pciDevice *dev, unsigned pos, uint8_t *buf, unsigned buflen)
if (pciOpenConfig(dev) < 0)
return -1;
if (pwrite(dev->fd, buf, buflen, pos) < 0) {
if (lseek(dev->fd, pos, SEEK_SET) != pos ||
safewrite(dev->fd, buf, buflen) != buflen) {
char ebuf[1024];
VIR_WARN(_("Failed to write to '%s' : %s"), dev->path,
virStrerror(errno, ebuf, sizeof(ebuf)));

View File

@ -185,7 +185,7 @@ endif
nodedevxml2xmltest_SOURCES = \
nodedevxml2xmltest.c \
testutils.c testutils.h
nodedevxml2xmltest_LDADD = ../src/libvirt_driver_qemu.la $(LDADDS)
nodedevxml2xmltest_LDADD = $(LDADDS)
virshtest_SOURCES = \
virshtest.c \