---
lib/drives.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/lib/drives.c b/lib/drives.c
index 82ef30093..7697f369a 100644
--- a/lib/drives.c
+++ b/lib/drives.c
@@ -28,6 +28,7 @@
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <assert.h>
@@ -645,7 +646,18 @@ parse_one_server (guestfs_h *g, const char *server, struct
drive_server *ret)
return -1;
}
ret->transport = drive_transport_unix;
- ret->u.socket = safe_strdup (g, server+5);
+
+ /* libvirt requires sockets to be specified as an absolute path
+ * (see RHBZ#1588451), and it's probably a good idea anyway to
+ * check the socket exists and convert it to an absolute path.
+ */
+ ret->u.socket = realpath (server+5, NULL);
+ if (ret->u.socket == NULL) {
+ perrorf (g, _("realpath: could not convert ā%sā to an absolute path"),
+ server+5);
+ return -1;
+ }
+
ret->port = 0;
return 0;
}
--
2.16.2