added childeren kill after parent exit

This commit is contained in:
2026-05-25 15:34:46 +03:00
parent 2d241c1e7c
commit c5003910ef
+8
View File
@@ -6,6 +6,8 @@
#include <dirent.h> #include <dirent.h>
#include <ctype.h> #include <ctype.h>
#include <time.h> #include <time.h>
#include <signal.h>
#include <sys/prctl.h>
#define DEFAULT_NUM_LEN 512 #define DEFAULT_NUM_LEN 512
@@ -287,6 +289,12 @@ int main(void)
} }
if (pid == 0) { if (pid == 0) {
if (prctl(PR_SET_PDEATHSIG, SIGKILL) != 0) {
_exit(1);
}
if (getppid() == 1) {
_exit(0);
}
pause(); pause();
return 0; return 0;
} }