Re: [PATCH 2/8] libmultipath: cleanup add_feature

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2022-10-07 at 12:35 -0500, Benjamin Marzinski wrote:
> add_feature() didn't correctly handle feature strings that used
> whitespace other than spaces, which the kernel allows. It also didn't
> allow adding features with multiple tokens. When it looked to see if
> the
> feature string to be added already existed, it didn't check if the
> match
> was part of a larger token. Finally, it did unnecessary work.  By
> using
> asprintf() to create the string, the function can be signifcantly
> simplified.
> 
> Signed-off-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx>

Reviewed-by: Martin Wilck <mwilck@xxxxxxxx>

The same general remarks apply as for 01/08.

> ---
>  libmultipath/structs.c | 49 +++++++++++++++++++++-------------------
> --
>  1 file changed, 24 insertions(+), 25 deletions(-)
> 
> diff --git a/libmultipath/structs.c b/libmultipath/structs.c
> index 1f9945e0..0f16c071 100644
> --- a/libmultipath/structs.c
> +++ b/libmultipath/structs.c
> @@ -602,23 +602,33 @@ int add_feature(char **f, const char *n)
>  {
>         int c = 0, d, l;
>         char *e, *t;
> +       const char *p;

Same remark as before about the variable naming. 

>  
>         if (!f)
>                 return 1;
>  
>         /* Nothing to do */
> -       if (!n || *n == '0')
> +       if (!n || *n == '\0')

ouch...

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux