From owner-svn-src-all@FreeBSD.ORG Thu Mar 3 19:55:16 2011 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 4E2721065679; Thu, 3 Mar 2011 19:55:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A3E48FC17; Thu, 3 Mar 2011 19:55:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p23JtGPW067828; Thu, 3 Mar 2011 19:55:16 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p23JtGqR067826; Thu, 3 Mar 2011 19:55:16 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201103031955.p23JtGqR067826@svn.freebsd.org> From: John Baldwin Date: Thu, 3 Mar 2011 19:55:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r219246 - stable/8/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: Thu, 03 Mar 2011 19:55:16 -0000 Author: jhb Date: Thu Mar 3 19:55:15 2011 New Revision: 219246 URL: http://svn.freebsd.org/changeset/base/219246 Log: MFC 218707: Properly check for errors from waitpid(). Modified: stable/8/usr.bin/truss/setup.c Directory Properties: stable/8/usr.bin/truss/ (props changed) Modified: stable/8/usr.bin/truss/setup.c ============================================================================== --- stable/8/usr.bin/truss/setup.c Thu Mar 3 18:52:11 2011 (r219245) +++ stable/8/usr.bin/truss/setup.c Thu Mar 3 19:55:15 2011 (r219246) @@ -83,7 +83,7 @@ setup_and_wait(char *command[]) } /* Only in the parent here */ - if (waitpid(pid, &waitval, 0) < -1) { + if (waitpid(pid, &waitval, 0) < 0) { err(1, "unexpect stop in waitpid"); return 0; } @@ -114,7 +114,7 @@ start_tracing(int pid) err(1, "can not attach to target process"); child_pid = pid; - if (waitpid(pid, &waitval, 0) < -1) + if (waitpid(pid, &waitval, 0) < 0) err(1, "Unexpect stop in waitpid"); return (0); @@ -133,7 +133,7 @@ restore_proc(int signo __unused) /* stop the child so that we can detach */ kill(child_pid, SIGSTOP); - if (waitpid(child_pid, &waitval, 0) < -1) + if (waitpid(child_pid, &waitval, 0) < 0) err(1, "Unexpected stop in waitpid"); if (ptrace(PT_DETACH, child_pid, (caddr_t)1, 0) < 0) @@ -183,7 +183,7 @@ waitevent(struct trussinfo *info) ptrace(PT_SYSCALL, info->pid, (caddr_t)1, pending_signal); pending_signal = 0; - if (waitpid(info->pid, &waitval, 0) < -1) { + if (waitpid(info->pid, &waitval, 0) < 0) { err(1, "Unexpected stop in waitpid"); }