aboutsummaryrefslogtreecommitdiff
path: root/tools/gsr-global-hotkeys
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-11-25 02:55:25 +0100
committerdec05eba <dec05eba@protonmail.com>2024-11-25 02:55:25 +0100
commit9467abb0a25a1277f2744cb1ac30c5b3b6491df3 (patch)
tree74183ce61f2c69b967496838822614d422e04e68 /tools/gsr-global-hotkeys
parent7d19afc0ab9ca880ea51fcab186bb2c5e9604aaf (diff)
Fix freeze on shutdown: change uid to user after getting seat permission
Diffstat (limited to 'tools/gsr-global-hotkeys')
-rw-r--r--tools/gsr-global-hotkeys/main.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/gsr-global-hotkeys/main.c b/tools/gsr-global-hotkeys/main.c
index 11eaee5..98ec6cf 100644
--- a/tools/gsr-global-hotkeys/main.c
+++ b/tools/gsr-global-hotkeys/main.c
@@ -197,6 +197,7 @@ static bool mapper_refresh_keymap(key_mapper *mapper) {
}
int main(void) {
+ const uid_t user_id = getuid();
if(geteuid() != 0) {
if(setuid(0) == -1) {
fprintf(stderr, "error: failed to change user to root\n");
@@ -233,6 +234,8 @@ int main(void) {
return 1;
}
+ setuid(user_id);
+
if(run_mainloop(libinput, &mapper) < 0) {
fprintf(stderr, "error: failed to start main loop\n");
return 1;