From 4054c35e9a9eca9b94c667331ed4af8ac2eb6638 Mon Sep 17 00:00:00 2001 From: Undefine Date: Sat, 2 Apr 2022 14:32:47 +0200 Subject: [PATCH] su: Change the HOME enviroment variable on login --- Userland/Utilities/su.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Userland/Utilities/su.cpp b/Userland/Utilities/su.cpp index ad53516b66..52b07df214 100644 --- a/Userland/Utilities/su.cpp +++ b/Userland/Utilities/su.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2018-2020, Andreas Kling + * Copyright (c) 2022, Undefine * * SPDX-License-Identifier: BSD-2-Clause */ @@ -48,6 +49,8 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio exec")); + TRY(Core::System::setenv("HOME"sv, account.home_directory(), true)); + execl(account.shell().characters(), account.shell().characters(), nullptr); perror("execl"); return 1;