Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Oct 2013 01:06:44 +0000 (UTC)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r257036 - head/sbin/mdconfig
Message-ID:  <201310240106.r9O16iKG030279@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hrs
Date: Thu Oct 24 01:06:44 2013
New Revision: 257036
URL: http://svnweb.freebsd.org/changeset/base/257036

Log:
  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.
  
  Spotted by:	Julian H. Stacey

Modified:
  head/sbin/mdconfig/mdconfig.c

Modified: head/sbin/mdconfig/mdconfig.c
==============================================================================
--- head/sbin/mdconfig/mdconfig.c	Thu Oct 24 01:03:42 2013	(r257035)
+++ head/sbin/mdconfig/mdconfig.c	Thu Oct 24 01:06:44 2013	(r257036)
@@ -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);
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310240106.r9O16iKG030279>