On Sun, Jul 24, 2011 at 9:43 PM,  <[email protected]> wrote:
> +/* Copy argument and remove trailing CR. Return the new length. */

As far as I can see the function below removes a trailing newline
instead of a trailing carriage return ?

> +static int sanitize_arg(const char *val, char *intf, int intf_len)
> +{
> +     int len;
> +
> +     if (!val)
> +             return 0;
> +
> +     /* Remove newline. */
> +     for (len = 0; len < intf_len - 1 && val[len] && val[len] != '\n'; len++)
> +             intf[len] = val[len];
> +     intf[len] = 0;
> +
> +     if (len == 0 || (val[len] != 0 && val[len] != '\n'))
> +             return 0;
> +
> +     return len;
> +}

Has it been considered to use strchr() to find the first occurrence of
a newline character in "val" ?

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to