Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Oct 2013 12:54:29 +0900 (JST)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        jhs@berklix.com
Cc:        current@FreeBSD.org
Subject:   Re: Regression in 10.0-BETA1, mdconfig has changed its return code.
Message-ID:  <20131023.125429.1473962573103517143.hrs@allbsd.org>
In-Reply-To: <201310230254.r9N2slD1067094@fire.js.berklix.net>
References:  <201310230254.r9N2slD1067094@fire.js.berklix.net>

next in thread | previous in thread | raw e-mail | index | archive | help
----Security_Multipart0(Wed_Oct_23_12_54_29_2013_858)--
Content-Type: Multipart/Mixed;
 boundary="--Next_Part(Wed_Oct_23_12_54_29_2013_828)--"
Content-Transfer-Encoding: 7bit

----Next_Part(Wed_Oct_23_12_54_29_2013_828)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

"Julian H. Stacey" <jhs@berklix.com> wrote
  in <201310230254.r9N2slD1067094@fire.js.berklix.net>:

jh> Regresssion in 10.0-BETA1, mdconfig -l -v return code changed from 0
jh> to 255.  OK, its not specfied in manual, but has changed.
jh> A test script I was using caught it:
jh> 	http://www.berklix.com/~jhs/bin/sh/mdconfig_tst
jh> Probably in next day or 2 I'll hack the C & send-pr.

 Does the attached patch fix it?

-- Hiroki

----Next_Part(Wed_Oct_23_12_54_29_2013_828)--
Content-Type: Text/X-Patch; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="mdconfig_20131023-1.diff"

Index: sbin/mdconfig/mdconfig.c
===================================================================
--- sbin/mdconfig/mdconfig.c	(revision 256952)
+++ sbin/mdconfig/mdconfig.c	(working copy)
@@ -481,12 +481,18 @@
 		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);
 }

 /*

----Next_Part(Wed_Oct_23_12_54_29_2013_828)----

----Security_Multipart0(Wed_Oct_23_12_54_29_2013_858)--
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (FreeBSD)

iEYEABECAAYFAlJnSHUACgkQTyzT2CeTzy1DmwCeO5keda5VeI77WcQc1bBHjQcH
Z2AAoM7AWam+zG2YwlaibM+uE3KTmPHL
=GxeR
-----END PGP SIGNATURE-----

----Security_Multipart0(Wed_Oct_23_12_54_29_2013_858)----



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