Re: Platform device matching, & weird strncmp usage

From: Bob Copeland
Date: Sat Jan 07 2006 - 14:41:52 EST


On 1/7/06, Kurtis D. Rader <kdrader@xxxxxxxxxx> wrote:
> On Fri, 2006-01-06 16:59:39, Benjamin Herrenschmidt wrote:
> > As far as I know, strncmp() is _NOT_ supposed to return 0 if one string
> > is shorter than the other and they match until that point

> I can't speak to the correctness of that code but your understanding of
> strncmp() is incorrect. From "GNU C Library Application Fundamentals":

I believe the original poster was asserting that
'strncmp("abc","abcd",100) should never return zero,' and not
'strncmp("abc","abcd",3) should never return zero.' Though I also
found the statement confusing at first.

-Bob
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/