Fixed zombification

This commit is contained in:
buffet 2019-04-17 17:40:56 +02:00
parent 0bfd115d3c
commit 6cf3a23ad0

View file

@ -16,6 +16,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/un.h> #include <sys/un.h>
#include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
@ -176,9 +177,25 @@ spawn_frontend(const char *path)
} }
if (pid == 0) { if (pid == 0) {
execlp(path, path, NULL); pid = fork();
wlr_log(WLR_ERROR, "Failed to start frontend (exec), continuing");
_exit(EXIT_FAILURE); if (pid < 0) {
wlr_log(WLR_ERROR, "Failed to start frontend (fork)");
_exit(EXIT_FAILURE);
}
if (pid == 0) {
execlp(path, path, NULL);
wlr_log(WLR_ERROR, "Failed to start frontend (exec), continuing");
_exit(EXIT_FAILURE);
}
_exit(EXIT_SUCCESS);
}
if (waitpid(pid, NULL, 0) < 0) {
wlr_log(WLR_ERROR, "Failed to start frontend (waitpid)");
return false;
} }
return true; return true;