[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] PATCH: Fix build on Mingw32



pread() and pwrite() do not exist on mingw, and the nodedevxml2xmltest
was adding libvirt_driver_qemu.la for some unknown reason - probably a
cut & paste error. This broke the test compile when qemu was turned off
as it is on mingw32.

Daniel

diff --git a/src/pci.c b/src/pci.c
--- a/src/pci.c
+++ b/src/pci.c
@@ -156,7 +156,8 @@ pciRead(pciDevice *dev, unsigned pos, ui
     if (pciOpenConfig(dev) < 0)
         return -1;
 
-    if (pread(dev->fd, buf, buflen, pos) < 0) {
+    if (lseek(dev->fd, pos, SEEK_SET) != pos ||
+        read(dev->fd, buf, buflen) < 0) {
         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, u
     if (pciOpenConfig(dev) < 0)
         return -1;
 
-    if (pwrite(dev->fd, buf, buflen, pos) < 0) {
+    if (lseek(dev->fd, pos, SEEK_SET) != pos ||
+        write(dev->fd, buf, buflen) < 0) {
         char ebuf[1024];
         VIR_WARN(_("Failed to write to '%s' : %s"), dev->path,
                  virStrerror(errno, ebuf, sizeof(ebuf)));
diff --git a/tests/Makefile.am b/tests/Makefile.am
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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 \

-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]