projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8da24ac
)
core: unset HOME=/ that the kernel gives us
author
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Tue, 21 May 2019 17:26:12 +0000
(19:26 +0200)
committer
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Wed, 22 May 2019 14:28:02 +0000
(16:28 +0200)
Partially fixes #12389.
%h would return "/" in a machine, but "/root" in a container. Let's fix
this by resetting $HOME to the expected value.
src/core/main.c
patch
|
blob
|
history
diff --git
a/src/core/main.c
b/src/core/main.c
index
e34da11
..
d65455c
100644
(file)
--- a/
src/core/main.c
+++ b/
src/core/main.c
@@
-1546,6
+1546,11
@@
static int fixup_environment(void) {
if (setenv("TERM", t, 1) < 0)
return -errno;
+ /* The kernels sets HOME=/ for init. Let's undo this. */
+ if (path_equal_ptr(getenv("HOME"), "/") &&
+ unsetenv("HOME") < 0)
+ log_warning_errno(errno, "Failed to unset $HOME: %m");
+
return 0;
}