level04: code refactorized
This commit is contained in:
parent
c6db5f49cd
commit
6fee805bf3
@ -7,31 +7,23 @@
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
int stat_loc;
|
|
||||||
char s[128];
|
char s[128];
|
||||||
int v6;
|
int wstatus;
|
||||||
int v7;
|
pid_t pid;
|
||||||
int v8;
|
|
||||||
pid_t v9;
|
|
||||||
|
|
||||||
v9 = fork();
|
pid = fork();
|
||||||
memset(s, 0, sizeof(s));
|
memset(s, 0, sizeof(s));
|
||||||
v8 = 0;
|
if (pid) {
|
||||||
stat_loc = 0;
|
|
||||||
if (v9) {
|
|
||||||
do {
|
do {
|
||||||
wait(&stat_loc);
|
wait(&wstatus);
|
||||||
v6 = stat_loc;
|
if (WIFSIGNALED(wstatus) ||
|
||||||
if ((stat_loc & 0x7F) == 0 ||
|
((char)(WIFSIGNALED(wstatus) + 1) >> 1 > 0)) {
|
||||||
(v7 = stat_loc,
|
|
||||||
(char)((stat_loc & 0x7F) + 1) >> 1 > 0)) {
|
|
||||||
puts("child is exiting...");
|
puts("child is exiting...");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
v8 = ptrace(PTRACE_PEEKUSER, v9, 44, 0);
|
} while (ptrace(PTRACE_PEEKUSER, pid, 44, 0) != 11);
|
||||||
} while (v8 != 11);
|
|
||||||
puts("no exec() for you");
|
puts("no exec() for you");
|
||||||
kill(v9, 9);
|
kill(pid, 9);
|
||||||
} else {
|
} else {
|
||||||
prctl(1, 1);
|
prctl(1, 1);
|
||||||
ptrace(PTRACE_TRACEME, 0, 0, 0);
|
ptrace(PTRACE_TRACEME, 0, 0, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user