|
|
e9bfca |
From 1db9a763c92eae49d05e5c7a4c9c5527cced2ad0 Mon Sep 17 00:00:00 2001
|
|
|
e9bfca |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
e9bfca |
Date: Thu, 14 Jun 2018 11:19:49 +0100
|
|
|
e9bfca |
Subject: [PATCH] lib: libvirt: Convert all socket parameters to an absolute
|
|
|
e9bfca |
path (RHBZ#1588451).
|
|
|
e9bfca |
|
|
|
e9bfca |
(cherry picked from commit 70bc83f893e6e0daf20ca7c9b7bfe875ceaed594)
|
|
|
e9bfca |
---
|
|
|
e9bfca |
lib/launch-libvirt.c | 15 ++++++++++++++-
|
|
|
e9bfca |
1 file changed, 14 insertions(+), 1 deletion(-)
|
|
|
e9bfca |
|
|
|
e9bfca |
diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
|
|
|
e9bfca |
index c709c4fe2..4df26825a 100644
|
|
|
e9bfca |
--- a/lib/launch-libvirt.c
|
|
|
e9bfca |
+++ b/lib/launch-libvirt.c
|
|
|
e9bfca |
@@ -23,6 +23,7 @@
|
|
|
e9bfca |
#include <stdarg.h>
|
|
|
e9bfca |
#include <stdbool.h>
|
|
|
e9bfca |
#include <unistd.h>
|
|
|
e9bfca |
+#include <limits.h>
|
|
|
e9bfca |
#include <fcntl.h>
|
|
|
e9bfca |
#include <grp.h>
|
|
|
e9bfca |
#include <errno.h>
|
|
|
e9bfca |
@@ -1706,8 +1707,20 @@ construct_libvirt_xml_disk_source_hosts (guestfs_h *g,
|
|
|
e9bfca |
}
|
|
|
e9bfca |
|
|
|
e9bfca |
case drive_transport_unix: {
|
|
|
e9bfca |
+ /* libvirt requires sockets to be specified as an absolute path
|
|
|
e9bfca |
+ * (RHBZ#1588451).
|
|
|
e9bfca |
+ */
|
|
|
e9bfca |
+ const char *socket = src->servers[i].u.socket;
|
|
|
e9bfca |
+ CLEANUP_FREE char *abs_socket = realpath (socket, NULL);
|
|
|
e9bfca |
+
|
|
|
e9bfca |
+ if (abs_socket == NULL) {
|
|
|
e9bfca |
+ perrorf (g, _("realpath: could not convert ā%sā to absolute path"),
|
|
|
e9bfca |
+ socket);
|
|
|
e9bfca |
+ return -1;
|
|
|
e9bfca |
+ }
|
|
|
e9bfca |
+
|
|
|
e9bfca |
attribute ("transport", "unix");
|
|
|
e9bfca |
- attribute ("socket", src->servers[i].u.socket);
|
|
|
e9bfca |
+ attribute ("socket", abs_socket);
|
|
|
e9bfca |
break;
|
|
|
e9bfca |
}
|
|
|
e9bfca |
}
|
|
|
e9bfca |
--
|
|
|
3d5c2a |
2.17.2
|
|
|
e9bfca |
|