bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH 3/7] name_equal: return early from function if src null-termi


From: Neal H. Walfield
Subject: Re: [PATCH 3/7] name_equal: return early from function if src null-terminates in the loop
Date: Fri, 13 Sep 2013 14:42:44 +0200
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Goj┼Ź) APEL/10.8 Emacs/23.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

At Fri, 13 Sep 2013 13:31:53 +0200,
Marin Ramesa wrote:
> diff --git a/device/dev_name.c b/device/dev_name.c
> index bf541df..6ce4b19 100644
> --- a/device/dev_name.c
> +++ b/device/dev_name.c
> @@ -69,9 +69,12 @@ name_equal(src, len, target)
>       int     len;
>       char    *target;
>  {
> -     while (--len >= 0)
> +     while (--len >= 0) {
>           if (*src++ != *target++)
>               return FALSE;
> +         if (*src == '\0' && *target != '\0')
> +             return FALSE;
> +     }

Shouldn't this return TRUE?

Neal



reply via email to

[Prev in Thread] Current Thread [Next in Thread]