summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2009-05-06 22:26:49 +0000
committerXin LI <delphij@FreeBSD.org>2009-05-06 22:26:49 +0000
commit3e2ab5b7300ce8add732a404884ac9ebb631a505 (patch)
tree5edd7d11f6f29fe91a4d76ce4c167ff2b7545d35 /usr.bin
parent2d3b0124c1c636f6ffb3006622de1cc254f22539 (diff)
Notes
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/truss/main.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.bin/truss/main.c b/usr.bin/truss/main.c
index a735f34f27b3..86a8981a7875 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>
@@ -159,6 +160,8 @@ main(int ac, char **av)
{
int c;
int i;
+ pid_t childpid;
+ int status;
char **command;
struct ex_types *funcs;
int initial_open;
@@ -283,8 +286,6 @@ START_TRACE:
if (trussinfo->curthread->in_fork &&
(trussinfo->flags & FOLLOWFORKS)) {
- int childpid;
-
trussinfo->curthread->in_fork = 0;
childpid =
funcs->exit_syscall(trussinfo,
@@ -355,6 +356,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);
}