summaryrefslogtreecommitdiffstats
path: root/daemon
diff options
context:
space:
mode:
authorRichard Jones <rjones@trick.home.annexia.org>2009-05-22 10:52:43 +0100
committerRichard Jones <rjones@trick.home.annexia.org>2009-05-22 10:52:43 +0100
commitf7ef94f5158cc56d7b1fb391e5907abd87dc4c3f (patch)
treeaef1920a7a73c642383d1f09cb24a47533dda47b /daemon
parent5f76f421d05041fc66fe0944ea3b85723f0d4cc4 (diff)
downloadlibguestfs-f7ef94f5158cc56d7b1fb391e5907abd87dc4c3f.tar.gz
libguestfs-f7ef94f5158cc56d7b1fb391e5907abd87dc4c3f.tar.xz
libguestfs-f7ef94f5158cc56d7b1fb391e5907abd87dc4c3f.zip
In daemon, set PATH, SHELL and LANG environment variables.
Diffstat (limited to 'daemon')
-rw-r--r--daemon/guestfsd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c
index 406c1041..1d740545 100644
--- a/daemon/guestfsd.c
+++ b/daemon/guestfsd.c
@@ -150,6 +150,14 @@ main (int argc, char *argv[])
if (sigaction (SIGPIPE, &sa, NULL) == -1)
perror ("sigaction SIGPIPE"); /* but try to continue anyway ... */
+ /* Set up a basic environment. After we are called by /init the
+ * environment is essentially empty.
+ * https://bugzilla.redhat.com/show_bug.cgi?id=502074#c5
+ */
+ setenv ("PATH", "/usr/bin:/bin", 1);
+ setenv ("SHELL", "/bin/sh", 1);
+ setenv ("LANG", "C", 1);
+
/* Resolve the hostname. */
memset (&hints, 0, sizeof hints);
hints.ai_socktype = SOCK_STREAM;