From owner-svn-src-all@FreeBSD.ORG Wed May 6 22:26:49 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5BC51065675; Wed, 6 May 2009 22:26:49 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D33488FC17; Wed, 6 May 2009 22:26:49 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n46MQn1P031774; Wed, 6 May 2009 22:26:49 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n46MQnGK031773; Wed, 6 May 2009 22:26:49 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200905062226.n46MQnGK031773@svn.freebsd.org> From: Xin LI Date: Wed, 6 May 2009 22:26:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191861 - stable/7/usr.bin/truss X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 May 2009 22:26:50 -0000 Author: delphij Date: Wed May 6 22:26:49 2009 New Revision: 191861 URL: http://svn.freebsd.org/changeset/base/191861 Log: MFC r191005: Don't exit until all truss children were exit. Modified: stable/7/usr.bin/truss/ (props changed) stable/7/usr.bin/truss/main.c Modified: stable/7/usr.bin/truss/main.c ============================================================================== --- stable/7/usr.bin/truss/main.c Wed May 6 22:26:04 2009 (r191860) +++ stable/7/usr.bin/truss/main.c Wed May 6 22:26:49 2009 (r191861) @@ -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 #include #include +#include #include #include @@ -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); }