diff options
author | Xin LI <delphij@FreeBSD.org> | 2009-04-13 16:23:32 +0000 |
---|---|---|
committer | Xin LI <delphij@FreeBSD.org> | 2009-04-13 16:23:32 +0000 |
commit | d5303c8027359108429e289880441311d89be62e (patch) | |
tree | 036b901eec94bed5791737623449cc217af9e99d /usr.bin/truss | |
parent | f0bcd5c3fa5d3fa188eae0a71ff60826dbae0db0 (diff) | |
download | src-test2-d5303c8027359108429e289880441311d89be62e.tar.gz src-test2-d5303c8027359108429e289880441311d89be62e.zip |
Notes
Diffstat (limited to 'usr.bin/truss')
-rw-r--r-- | usr.bin/truss/main.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.bin/truss/main.c b/usr.bin/truss/main.c index 54f7ee8c43e7..9c1589b2e7e9 100644 --- a/usr.bin/truss/main.c +++ b/usr.bin/truss/main.c @@ -1,4 +1,4 @@ -/* +/*- * Copryight 1997 Sean Eric Fagan * * Redistribution and use in source and binary forms, with or without @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include <sys/time.h> #include <sys/resource.h> #include <sys/sysctl.h> +#include <sys/wait.h> #include <ctype.h> #include <err.h> @@ -164,6 +165,8 @@ main(int ac, char **av) { int c; int i; + pid_t childpid; + int status; char **command; struct ex_types *funcs; int initial_open; @@ -288,8 +291,6 @@ START_TRACE: if (trussinfo->curthread->in_fork && (trussinfo->flags & FOLLOWFORKS)) { - int childpid; - trussinfo->curthread->in_fork = 0; childpid = funcs->exit_syscall(trussinfo, @@ -360,6 +361,11 @@ START_TRACE: } } while (trussinfo->pr_why != S_EXIT); fflush(trussinfo->outfile); - + + if (trussinfo->flags & FOLLOWFORKS) + do { + childpid = wait(&status); + } while (childpid != -1); + return (0); } |