[libvirt] [PATCH v2 3/3] qemu: command: Override HOME variable for system QEMU

Erik Skultety posted 3 patches 6 years, 11 months ago
[libvirt] [PATCH v2 3/3] qemu: command: Override HOME variable for system QEMU
Posted by Erik Skultety 6 years, 11 months ago
By default, qemu user's home dir points to '/' which shouldn't be used
at all. We therefore pass the HOME variable from the current variable
iff not running as SUID, which means that for systemd we never set it.
This patch makes sure, that for system QEMU this is always set to
libDir/<driver>, session mode is left untouched.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
---
 src/qemu/qemu_command.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 23be0d8554..26c36d2e19 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10671,6 +10671,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
         virCommandAddEnvFormat(cmd, "XDG_CACHE_HOME=%s/%s",
                                priv->libDir, ".cache");
     } else {
+        virCommandAddEnvPair(cmd, "HOME", priv->libDir);
         virCommandAddEnvXDG(cmd, priv->libDir);
     }
 
-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 3/3] qemu: command: Override HOME variable for system QEMU
Posted by Daniel P. Berrangé 6 years, 11 months ago
On Fri, Mar 08, 2019 at 01:00:49PM +0100, Erik Skultety wrote:
> By default, qemu user's home dir points to '/' which shouldn't be used
> at all. We therefore pass the HOME variable from the current variable
> iff not running as SUID, which means that for systemd we never set it.
> This patch makes sure, that for system QEMU this is always set to
> libDir/<driver>, session mode is left untouched.
> 
> Signed-off-by: Erik Skultety <eskultet@redhat.com>
> ---
>  src/qemu/qemu_command.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

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