From owner-freebsd-current@FreeBSD.ORG Wed Oct 23 16:23:50 2013 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E0A5E5A3; Wed, 23 Oct 2013 16:23:50 +0000 (UTC) (envelope-from jhs@berklix.com) Received: from land.berklix.org (land.berklix.org [144.76.10.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 55B712AF6; Wed, 23 Oct 2013 16:23:49 +0000 (UTC) Received: from mart.js.berklix.net (p5DCBC2D8.dip0.t-ipconnect.de [93.203.194.216]) (authenticated bits=128) by land.berklix.org (8.14.5/8.14.5) with ESMTP id r9NGNlVK012059; Wed, 23 Oct 2013 16:23:47 GMT (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (fire.js.berklix.net [192.168.91.41]) by mart.js.berklix.net (8.14.3/8.14.3) with ESMTP id r9NGNemt091108; Wed, 23 Oct 2013 18:23:40 +0200 (CEST) (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (localhost.js.berklix.net [127.0.0.1]) by fire.js.berklix.net (8.14.4/8.14.4) with ESMTP id r9NGNYRn046354; Wed, 23 Oct 2013 18:23:40 +0200 (CEST) (envelope-from jhs@fire.js.berklix.net) Message-Id: <201310231623.r9NGNYRn046354@fire.js.berklix.net> To: Hiroki Sato Subject: Re: Regression in 10.0-BETA1, mdconfig has changed its return code. From: "Julian H. Stacey" Organization: http://berklix.com BSD Unix Linux Consultancy, Munich Germany User-agent: EXMH on FreeBSD http://berklix.com/free/ X-URL: http://www.berklix.com In-reply-to: Your message "Wed, 23 Oct 2013 12:54:29 +0900." <20131023.125429.1473962573103517143.hrs@allbsd.org> Date: Wed, 23 Oct 2013 18:23:34 +0200 Sender: jhs@berklix.com Cc: current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2013 16:23:50 -0000 Hi Hiroki & current@ Hiroki Sato wrote: > "Julian H. Stacey" wrote > 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 I missed a '.' : 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? Yes. It now returns zero. ( I started to read through what your diff fixes, but tired of it as there are no comments in the original what variables are, Glad you figured them out, & I assume all OK. ) Thanks for fixing it :-) > -- Hiroki > > 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); > } > > /* > Julian Stacey, BSD Unix Linux C Sys Eng Consultant, Munich http://berklix.com Interleave replies below like a play script. Indent old text with "> ". Send plain text, not quoted-printable, HTML, base64, or multipart/alternative.