su: Change the HOME enviroment variable on login

This commit is contained in:
Undefine 2022-04-02 14:32:47 +02:00 committed by Andreas Kling
parent defe7b4ecc
commit 4054c35e9a
Notes: sideshowbarker 2024-07-17 11:18:29 +09:00

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2022, Undefine <undefine@undefine.pl>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -48,6 +49,8 @@ ErrorOr<int> 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;