Double fork to fix xwayland bug

This commit is contained in:
project-repo 2022-03-29 10:05:15 +02:00
commit 6e1464127f
2 changed files with 11 additions and 12 deletions

View file

@ -83,14 +83,6 @@ set_sig_handler(int sig, void (*action)(int)) {
}
}
void
sig_chld_handler(int signal) {
int pid = 1;
while(pid > 0) {
pid = waitpid(WAIT_ANY, NULL, WNOHANG);
}
}
static bool
drop_permissions(void) {
if(getuid() != geteuid() || getgid() != getegid()) {
@ -326,8 +318,6 @@ main(int argc, char *argv[]) {
wl_event_loop_add_signal(event_loop, SIGALRM, handle_signal, &server);
server.event_loop = event_loop;
set_sig_handler(SIGCHLD, sig_chld_handler);
backend = wlr_backend_autocreate(server.wl_display);
if(!backend) {
wlr_log(WLR_ERROR, "Unable to create the wlroots backend");

View file

@ -2,6 +2,7 @@
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
#include <wayland-server-core.h>
#include <wlr/backend/multi.h>
#include <wlr/backend/session.h>
@ -1396,8 +1397,16 @@ run_action(enum keybinding_action action, struct cg_server *server,
keybinding_split_vertical(server);
break;
case KEYBINDING_RUN_COMMAND:
if(fork() == 0) {
into_process(data.c);
{
int pid;
if((pid=fork()) == 0) {
if(fork() == 0) {
into_process(data.c);
}
_exit(0);
} else if(pid > 0) {
waitpid(pid,NULL,0);
}
}
break;
case KEYBINDING_CYCLE_VIEWS: