[PATCHv2 5/6] Use virGetUninstalledDir() in src/fdstream.c

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

 



src/storage/storage_backend_disk.c:
   *Check if libvirtd is running uninstalled from a build tree and change
    parthelper_path accordingly

---
 src/fdstream.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/fdstream.c b/src/fdstream.c
index d0435c7..031d9f5 100644
--- a/src/fdstream.c
+++ b/src/fdstream.c
@@ -593,6 +593,8 @@ virFDStreamOpenFileInternal(virStreamPtr st,
     struct stat sb;
     virCommandPtr cmd = NULL;
     int errfd = -1;
+    char *uninstalledDir = NULL;
+    char *iohelper_path = NULL;
 
     VIR_DEBUG("st=%p path=%s oflags=%x offset=%llu length=%llu mode=%o",
               st, path, oflags, offset, length, mode);
@@ -648,9 +650,22 @@ virFDStreamOpenFileInternal(virStreamPtr st,
             goto error;
         }
 
+        uninstalledDir = virGetUninstalledDir();
+
+        if (uninstalledDir && virAsprintf(&iohelper_path,
+                                          "%s/../../src/libvirt_iohelper",
+                                          uninstalledDir) < 0)
+            goto error;
+        else if (virAsprintf(&iohelper_path,
+                             LIBEXECDIR "/libvirt_iohelper") < 0)
+            goto error;
+
         cmd = virCommandNewArgList(iohelper_path,
                                    path,
                                    NULL);
+
+        VIR_FREE(iohelper_path);
+
         virCommandAddArgFormat(cmd, "%llu", length);
         virCommandPassFD(cmd, fd,
                          VIR_COMMAND_PASS_FD_CLOSE_PARENT);
@@ -683,6 +698,7 @@ error:
     VIR_FORCE_CLOSE(fd);
     VIR_FORCE_CLOSE(childfd);
     VIR_FORCE_CLOSE(errfd);
+    VIR_FREE(iohelper_path);
     if (oflags & O_CREAT)
         unlink(path);
     return -1;
-- 
1.7.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]