From owner-svn-src-stable-10@FreeBSD.ORG Thu Oct 9 23:17:19 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9499C9CF; Thu, 9 Oct 2014 23:17:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7FBECB7D; Thu, 9 Oct 2014 23:17:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99NHJEr070774; Thu, 9 Oct 2014 23:17:19 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99NHJpW070773; Thu, 9 Oct 2014 23:17:19 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410092317.s99NHJpW070773@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Thu, 9 Oct 2014 23:17:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r272854 - stable/10/sbin/mdconfig X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 23:17:19 -0000 Author: hrs Date: Thu Oct 9 23:17:18 2014 New Revision: 272854 URL: https://svnweb.freebsd.org/changeset/base/272854 Log: MFC r257036: Return 0 if: 1. "-u N" specified, no -f, and mdN found, 2. no -u, "-f /pathname" specified, and mdN associated with /pathname found, 3. "-u N" specified, "-f /pathname" specified, and both of them found, 4. "-l" specified and no -f, 5. "-l" specified, "-f /pathname" specified, and /pathname found. otherwise return -1. Modified: stable/10/sbin/mdconfig/mdconfig.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/mdconfig/mdconfig.c ============================================================================== --- stable/10/sbin/mdconfig/mdconfig.c Thu Oct 9 23:15:26 2014 (r272853) +++ stable/10/sbin/mdconfig/mdconfig.c Thu Oct 9 23:17:18 2014 (r272854) @@ -481,12 +481,18 @@ md_list(const char *units, int opt, cons printf("\n"); /* XXX: Check if it's enough to clean everything. */ geom_stats_snapshot_free(sq); - if (((opt & OPT_UNIT) && (fflag == NULL) && ufound) || - ((opt & OPT_UNIT) == 0 && (fflag != NULL) && ffound) || - ((opt & OPT_UNIT) && (fflag != NULL) && ufound && ffound)) - return (0); - else - return (-1); + if (opt & OPT_UNIT) { + if (((fflag == NULL) && ufound) || + ((fflag == NULL) && (units != NULL) && ufound) || + ((fflag != NULL) && ffound) || + ((fflag != NULL) && (units != NULL) && ufound && ffound)) + return (0); + } else if (opt & OPT_LIST) { + if ((fflag == NULL) || + ((fflag != NULL) && ffound)) + return (0); + } + return (-1); } /*