[lvm-devel] [PATCH 15/23] Add test check for find_config_str

Alasdair G Kergon agk at redhat.com
Wed Jan 5 00:49:06 UTC 2011


On Wed, Dec 22, 2010 at 11:00:41AM +0100, Zdenek Kabelac wrote:
> >> -	get_config_uint32(cft->root, "creation_time", &u);
> >> +	(void) get_config_uint32(cft->root, "creation_time", &u);
> > 
> > What's wrong here? I thought that this is needed only
> > if is defined with warn_if_unused_result?
> 
> When we ignore return value - we should do that explicitly
> when we test all other cases - it's being reported as suspicious.
> 
> IMHO more important question here is - if it's correct to have
> this function returning void.
 
Exactly - the real problem is: what if the field is not present?
Well the code seems to permit that:
It uses a description of "" if there's no description, and a time
of 0 if there's no creation_time.

So I think (void) was indeed the intention.

Alasdair




More information about the lvm-devel mailing list