mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
launch: libvirt: Add 'is_root' flag to the params struct.
This is just code motion, but it allows us to read this flag inside the 'construct_libvirt_xml_seclabel' function in future (as a possible way to fix RHBZ#890291).
This commit is contained in:
@@ -123,6 +123,7 @@ struct libvirt_xml_params {
|
||||
char console_sock[UNIX_PATH_MAX];
|
||||
bool enable_svirt; /* false if we decided to disable sVirt */
|
||||
bool is_kvm; /* false = qemu, true = kvm */
|
||||
bool is_root; /* true = euid is root */
|
||||
};
|
||||
|
||||
static int parse_capabilities (guestfs_h *g, const char *capabilities_xml, struct libvirt_xml_params *params);
|
||||
@@ -142,7 +143,6 @@ static int
|
||||
launch_libvirt (guestfs_h *g, const char *libvirt_uri)
|
||||
{
|
||||
unsigned long version;
|
||||
int is_root = geteuid () == 0;
|
||||
virConnectPtr conn = NULL;
|
||||
virDomainPtr dom = NULL;
|
||||
char *capabilities_xml = NULL;
|
||||
@@ -160,6 +160,8 @@ launch_libvirt (guestfs_h *g, const char *libvirt_uri)
|
||||
struct drive *drv;
|
||||
size_t i;
|
||||
|
||||
params.is_root = geteuid () == 0;
|
||||
|
||||
/* XXX: It should be possible to make this work. */
|
||||
if (g->direct) {
|
||||
error (g, _("direct mode flag is not supported yet for libvirt attach method"));
|
||||
@@ -312,7 +314,7 @@ launch_libvirt (guestfs_h *g, const char *libvirt_uri)
|
||||
* (3) SELinux/sVirt will prevent access. libvirt ought to
|
||||
* label the socket.
|
||||
*/
|
||||
if (is_root) {
|
||||
if (params.is_root) {
|
||||
struct group *grp;
|
||||
|
||||
if (chmod (params.guestfsd_sock, 0775) == -1) {
|
||||
|
||||
Reference in New Issue
Block a user