Re: [PATCH] fix to strchr() in lib/string.c

From: Nicolas Pitre (
Date: Sat Sep 21 2002 - 14:28:22 EST

On Sat, 21 Sep 2002, Dan Aloni wrote:

> On Sat, Sep 21, 2002 at 12:25:59PM -0400, Nicolas Pitre wrote:
> >
> > The return value of strchr("foo",0) should be the start address of
> > "foo" + 3, not NULL.
> Correct me if I'm wrong, but no fix is needed.
> strchr("foo", 0) doesn't return NULL, for the simple fact that
> the loop will stop when reaching '\0' before the 'if' that returns
> NULL, and then s will be returned.

Doh. You're right.

I was fixing some architecture specific version and someone I usually trust
led me to believe this one was broken too, and I obviously didn't look
carefully enough.

(no no I won't say it was you Russell) ;-)


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Mon Sep 23 2002 - 22:00:33 EST