mirror of
https://github.com/rui314/mold.git
synced 2024-12-26 18:02:30 +03:00
wip
This commit is contained in:
parent
3c26c51f8f
commit
a2857890f1
@ -5,6 +5,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>
|
||||||
|
|
||||||
#define DAEMON_TIMEOUT 30
|
#define DAEMON_TIMEOUT 30
|
||||||
@ -28,8 +29,17 @@ std::function<void()> fork_child() {
|
|||||||
if (pid > 0) {
|
if (pid > 0) {
|
||||||
// Parent
|
// Parent
|
||||||
close(pipefd[1]);
|
close(pipefd[1]);
|
||||||
i64 r = read(pipefd[0], (char[1]){}, 1);
|
if (read(pipefd[0], (char[1]){}, 1) == 1)
|
||||||
_exit(r != 1);
|
_exit(0);
|
||||||
|
|
||||||
|
int status;
|
||||||
|
waitpid(pid, &status, 0);
|
||||||
|
|
||||||
|
if (WIFEXITED(status))
|
||||||
|
_exit(WEXITSTATUS(status));
|
||||||
|
if (WIFSIGNALED(status))
|
||||||
|
Error() << "mold: killed by signal " << WTERMSIG(status);
|
||||||
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Child
|
// Child
|
||||||
|
Loading…
Reference in New Issue
Block a user