commit debdc5bf90b0a8baee544b8899d38af078d90787
parent 2b913b2400645b5aab68f127cd84f4ea1e16774b
Author: sin <sin@2f30.org>
Date: Fri, 1 Mar 2013 15:07:49 +0000
memzap: Simplify waiting for the child
Diffstat:
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/memzap.c b/memzap.c
@@ -40,7 +40,6 @@ main(int argc, char *argv[])
execl(argv[1], argv[1], (char *)NULL);
_Exit(1);
default:
- waitpid(pid, &stat, WSTOPPED);
break;
}
@@ -54,11 +53,10 @@ main(int argc, char *argv[])
printf("Single stepping child with pid %jd\n",
(intmax_t)pid);
- single_step(pid);
- waitpid(pid, &stat, WSTOPPED);
-
+ wait(&stat);
if (!WIFSTOPPED(stat))
goto out_mmap;
+ single_step(pid);
do {
readmem(pid, buf, addr, len);
@@ -71,7 +69,7 @@ main(int argc, char *argv[])
errx(1, "Failed to build memory tree\n");
single_step(pid);
- waitpid(pid, &stat, WSTOPPED);
+ wait(&stat);
if (!WIFSTOPPED(stat)) {
free_mem_region(mr_old);