From 9467abb0a25a1277f2744cb1ac30c5b3b6491df3 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 25 Nov 2024 02:55:25 +0100 Subject: Fix freeze on shutdown: change uid to user after getting seat permission --- tools/gsr-global-hotkeys/main.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tools') 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; -- cgit v1.2.3