added childeren kill after parent exit
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user