summaryrefslogtreecommitdiff
path: root/Userland/Utilities
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2021-01-30 22:52:30 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-01 09:54:32 +0100
commit261727957945a510c8c41af99bc903bd8ca60e74 (patch)
tree5455ef526b4f94fae40fd62474eb2c7a83464446 /Userland/Utilities
parent0e3408d4d603ab3d1945818ed5875eaf5b4c6b4b (diff)
downloadserenity-261727957945a510c8c41af99bc903bd8ca60e74.zip
keymap: Unveil path, if one is given
Diffstat (limited to 'Userland/Utilities')
-rw-r--r--Userland/Utilities/keymap.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/Userland/Utilities/keymap.cpp b/Userland/Utilities/keymap.cpp
index 47c4b00623..1ee4631e25 100644
--- a/Userland/Utilities/keymap.cpp
+++ b/Userland/Utilities/keymap.cpp
@@ -42,17 +42,22 @@ int main(int argc, char** argv)
return 1;
}
- if (unveil(nullptr, nullptr) < 0) {
- perror("unveil");
- return 1;
- }
-
const char* path = nullptr;
Core::ArgsParser args_parser;
args_parser.add_positional_argument(path, "The mapping file to be used", "file", Core::ArgsParser::Required::No);
args_parser.parse(argc, argv);
- dbgln("path is at {:p}, and contains {}", path, path);
+ if (path && path[0] == '/') {
+ if (unveil(path, "r") < 0) {
+ perror("unveil path");
+ return 1;
+ }
+ }
+
+ if (unveil(nullptr, nullptr) < 0) {
+ perror("unveil");
+ return 1;
+ }
if (!path) {
auto keymap = Keyboard::CharacterMap::fetch_system_map();