diff options
author | kleines Filmröllchen <filmroellchen@serenityos.org> | 2022-04-09 12:35:21 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-04-11 00:08:48 +0200 |
commit | 0fd09b2381e7d01eeb80cf811415f54174b03b56 (patch) | |
tree | 1c1bfa401b242e266dbbdc877292e70ac8835bbc /Userland/Services | |
parent | 46b76f2f55f61f45fc292f800ba2a4e2a5c354be (diff) | |
download | serenity-0fd09b2381e7d01eeb80cf811415f54174b03b56.zip |
LibCore: Automatically create config directories if necessary
If the .config directory (or its children, like lib) was deleted,
ConfigFile would crash because it would try to open or create a file in
a directory that didn't exist. Therefore, for user and library configs
(but not system configs), ensure that the parent directories exist. This
allows the user to delete the entire .config folder and all apps still
work. (Except those which can't handle missing config. That's a separate
issue though.)
Fixes #13555
Note: Some changes to pledges and unveils are necessary for this to
work. The only one who can recreate .config at the moment is
ConfigServer, as others probably don't pledge the user home directory.
Diffstat (limited to 'Userland/Services')
-rw-r--r-- | Userland/Services/ConfigServer/main.cpp | 1 | ||||
-rw-r--r-- | Userland/Services/KeyboardPreferenceLoader/main.cpp | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/Userland/Services/ConfigServer/main.cpp b/Userland/Services/ConfigServer/main.cpp index da08477e1c..1cb55d4e2b 100644 --- a/Userland/Services/ConfigServer/main.cpp +++ b/Userland/Services/ConfigServer/main.cpp @@ -14,6 +14,7 @@ ErrorOr<int> serenity_main(Main::Arguments) { TRY(Core::System::pledge("stdio accept rpath wpath cpath")); TRY(Core::System::unveil(Core::StandardPaths::config_directory(), "rwc")); + TRY(Core::System::unveil(Core::StandardPaths::home_directory(), "rwc")); TRY(Core::System::unveil(nullptr, nullptr)); Core::EventLoop event_loop; diff --git a/Userland/Services/KeyboardPreferenceLoader/main.cpp b/Userland/Services/KeyboardPreferenceLoader/main.cpp index 247421e782..7cc995c950 100644 --- a/Userland/Services/KeyboardPreferenceLoader/main.cpp +++ b/Userland/Services/KeyboardPreferenceLoader/main.cpp @@ -16,7 +16,7 @@ ErrorOr<int> serenity_main(Main::Arguments) { - TRY(Core::System::pledge("stdio proc exec rpath")); + TRY(Core::System::pledge("stdio proc exec rpath cpath")); auto keyboard_settings_config = TRY(Core::ConfigFile::open_for_app("KeyboardSettings")); TRY(Core::System::unveil("/bin/keymap", "x")); |