From owner-svn-src-all@FreeBSD.ORG Sun Oct 10 20:37:38 2010 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 CEA2D1065674; Sun, 10 Oct 2010 20:37:38 +0000 (UTC) (envelope-from randi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BDA4E8FC0C; Sun, 10 Oct 2010 20:37:38 +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 o9AKbcL8092504; Sun, 10 Oct 2010 20:37:38 GMT (envelope-from randi@svn.freebsd.org) Received: (from randi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9AKbcFG092501; Sun, 10 Oct 2010 20:37:38 GMT (envelope-from randi@svn.freebsd.org) Message-Id: <201010102037.o9AKbcFG092501@svn.freebsd.org> From: Randi Harper Date: Sun, 10 Oct 2010 20:37:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213672 - in head/usr.sbin: mfiutil mptutil 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: Sun, 10 Oct 2010 20:37:38 -0000 Author: randi Date: Sun Oct 10 20:37:38 2010 New Revision: 213672 URL: http://svn.freebsd.org/changeset/base/213672 Log: Report subcommand handler errors in mfiutil/mptutil so that tools that invoke the utilities can robustly report errors. Submitted by: gcooper Reviewed by: jhb Approved by: cperciva (mentor) MFC after: 1 week Modified: head/usr.sbin/mfiutil/mfiutil.c head/usr.sbin/mptutil/mptutil.c Modified: head/usr.sbin/mfiutil/mfiutil.c ============================================================================== --- head/usr.sbin/mfiutil/mfiutil.c Sun Oct 10 12:21:35 2010 (r213671) +++ head/usr.sbin/mfiutil/mfiutil.c Sun Oct 10 20:37:38 2010 (r213672) @@ -125,10 +125,12 @@ main(int ac, char **av) SET_FOREACH(cmd, MFI_DATASET(top)) { if (strcmp((*cmd)->name, av[0]) == 0) { - (*cmd)->handler(ac, av); - return (0); + if ((*cmd)->handler(ac, av)) + return (1); + else + return (0); } } warnx("Unknown command %s.", av[0]); - return (0); + return (1); } Modified: head/usr.sbin/mptutil/mptutil.c ============================================================================== --- head/usr.sbin/mptutil/mptutil.c Sun Oct 10 12:21:35 2010 (r213671) +++ head/usr.sbin/mptutil/mptutil.c Sun Oct 10 20:37:38 2010 (r213672) @@ -114,10 +114,12 @@ main(int ac, char **av) SET_FOREACH(cmd, MPT_DATASET(top)) { if (strcmp((*cmd)->name, av[0]) == 0) { - (*cmd)->handler(ac, av); - return (0); + if ((*cmd)->handler(ac, av)) + return (1); + else + return (0); } } warnx("Unknown command %s.", av[0]); - return (0); + return (1); }