[lvm-devel] shared segtypes loading

dustin at v.igoro.us dustin at v.igoro.us
Thu Feb 8 16:42:56 UTC 2007


On Thu, Feb 08, 2007 at 11:31:45AM -0500, Dave Wysochanski wrote:
> Moving the add below the list_iterate_safe will still add it to the list
> even if there's a duplicate right?  So maybe the right thing is
> something like this:
> 
> Index: LVM2/lib/commands/toolcontext.c
> ===================================================================
> --- LVM2.orig/lib/commands/toolcontext.c	2007-02-08 11:27:13.000000000 -0500
> +++ LVM2/lib/commands/toolcontext.c	2007-02-08 11:27:24.000000000 -0500
> @@ -777,7 +777,8 @@ static int _init_segtypes(struct cmd_con
>  
>  			list_iterate_safe(sgtl, tmp, &cmd->segtypes) {
>  				segtype2 = list_item(sgtl, struct segment_type);
> -				if (!strcmp(segtype2->name, segtype->name)) {
> +				if ( (segtype2 != segtype) &&
> +				     !strcmp(segtype2->name, segtype->name)) {
>  					log_error("Duplicate segment type %s: "
>  						  "unloading shared library %s",
>  						  segtype->name, cv->v.str);

Agreed, that would be better.

Dustin




More information about the lvm-devel mailing list