mirror of
https://github.com/systemd/systemd.git
synced 2025-03-19 22:50:17 +03:00
core: unset HOME=/ that the kernel gives us
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.
This commit is contained in:
parent
8da24acad5
commit
9d48671c62
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user