mountcritlocal and mountlate issue

Brooks Davis brooks at freebsd.org
Tue Mar 20 15:45:36 UTC 2007


On Tue, Mar 20, 2007 at 06:10:33PM +0300, Sergey Baturov wrote:
> Hi, all! 
> 
> I've found a small non-critical issue in /etc/rc.d/mountcritlocal
> and /etc/rc.d/mountlate scripts. The issue is the same: 
> 
> 	mount -a ...
> 	echo '.' 
> 
> 	case $? in
> 	0)
> 		;;
> 	*)
> 		... 
> 
> There is no situation when 'case' would have a value other then '0'
> because 'echo' executed just before the 'case' and the last command
> exit status will almost always be zero. And the user will never see
> error message in '*' case. 
> 
> Is this correct? 

Yes, this is a common mistake.  I think the easiest solution is
probablly to save $? after the mount call and refer to the saved value.
That and replacing the case with an if statement since test will do the
job just fine.

-- Brooks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-rc/attachments/20070320/5bc6ce7b/attachment.pgp


More information about the freebsd-rc mailing list