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