On Fri, Sep 01, 2023 at 08:02:15PM +0200, mwi...@suse.com wrote:
> From: Martin Wilck <mwi...@suse.com>
> 
> Factor out a trivial helper function.
> 
> Signed-off-by: Martin Wilck <mwi...@suse.com>
> Cc: David Bond <db...@suse.com>
> ---
>  libmultipath/alias.c | 34 ++++++++++++++++++++--------------
>  1 file changed, 20 insertions(+), 14 deletions(-)
> @@ -120,20 +137,9 @@ id_already_taken(int id, const char *prefix, const char 
> *map_wwid)
>               return 0;
>  
>       alias = get_strbuf_str(&buf);
> -     if (dm_map_present(alias)) {
> -             char wwid[WWID_SIZE];
> -
> -             /* If both the name and the wwid match, then it's fine.*/
> -             if (dm_get_uuid(alias, wwid, sizeof(wwid)) == 0 &&
> -                 strncmp(map_wwid, wwid, sizeof(wwid)) == 0)

Possibly this should return "false" to match the bool return type.
Otherwise, it looks fine.

-Ben

> -                     return 0;
> -             condlog(3, "%s: alias '%s' already taken, but not in bindings 
> file. reselecting alias", map_wwid, alias);
> -             return 1;
> -     }
> -     return 0;
> +     return alias_already_taken(alias, map_wwid);
>  }
>  
> -
>  /*
>   * Returns: 0   if matching entry in WWIDs file found
>   *         -1   if an error occurs
> -- 
> 2.41.0
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel

Reply via email to