aboutsummaryrefslogtreecommitdiff
path: root/tools/gsr-global-hotkeys/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gsr-global-hotkeys/main.c')
-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;