diff --git a/fork_bomb/fork_bomb.c b/fork_bomb/fork_bomb.c index cfe4dbc..579294c 100644 --- a/fork_bomb/fork_bomb.c +++ b/fork_bomb/fork_bomb.c @@ -6,6 +6,8 @@ #include #include #include +#include +#include #define DEFAULT_NUM_LEN 512 @@ -287,6 +289,12 @@ int main(void) } if (pid == 0) { + if (prctl(PR_SET_PDEATHSIG, SIGKILL) != 0) { + _exit(1); + } + if (getppid() == 1) { + _exit(0); + } pause(); return 0; }