Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "sys/prctl.h"
- #include "stdlib.h"
- #include "string.h"
- #include "unistd.h"
- int main(int argc, char ** argv)
- {
- pid_t pid = fork();
- if (pid)
- {
- waitpid(pid); // Parent waits for child to die.
- }
- else
- {
- prctl(PR_SET_PDEATHSIG, atoi(argv[1]),0,0,0); // Get a signal if parent dies.
- execvp(argv[2], &(argv[2])); // Execute program (or script).
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment