mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-03-31 09:17:04 +09:00
Fix freeze on shutdown: change uid to user after getting seat permission
This commit is contained in:
@@ -197,6 +197,7 @@ static bool mapper_refresh_keymap(key_mapper *mapper) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
|
const uid_t user_id = getuid();
|
||||||
if(geteuid() != 0) {
|
if(geteuid() != 0) {
|
||||||
if(setuid(0) == -1) {
|
if(setuid(0) == -1) {
|
||||||
fprintf(stderr, "error: failed to change user to root\n");
|
fprintf(stderr, "error: failed to change user to root\n");
|
||||||
@@ -233,6 +234,8 @@ int main(void) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setuid(user_id);
|
||||||
|
|
||||||
if(run_mainloop(libinput, &mapper) < 0) {
|
if(run_mainloop(libinput, &mapper) < 0) {
|
||||||
fprintf(stderr, "error: failed to start main loop\n");
|
fprintf(stderr, "error: failed to start main loop\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user