Re: Regression in 10.0-BETA1, mdconfig has changed its return code.

From: Julian H. Stacey <jhs_at_berklix.com>
Date: Wed, 23 Oct 2013 18:23:34 +0200
Hi Hiroki & current_at_

Hiroki Sato wrote:
> "Julian H. Stacey" <jhs_at_berklix.com> 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)
> _at__at_ -481,12 +481,18 _at__at_
>  		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.
Received on Wed Oct 23 2013 - 14:23:50 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:43 UTC