strrchr: actually, last one was finding "" in "any" at pos 0,
authorDenis Vlasenko <vda.linux@googlemail.com>
Wed, 18 Jun 2008 20:01:12 +0000 (20:01 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Wed, 18 Jun 2008 20:01:12 +0000 (20:01 -0000)
should find at pos LAST...

libbb/strrstr.c

index 088d9f45733934d1aa863fde08d3ecee865a94c2..f61dd517fa32f643cb99a0fe98eddcf433bcf176 100644 (file)
@@ -24,7 +24,7 @@ char* strrstr(const char *haystack, const char *needle)
        char *r = NULL;
 
        if (!needle[0])
-               return (char*)haystack;
+               return (char*)haystack + strlen(haystack);
        while (1) {
                char *p = strstr(haystack, needle);
                if (!p)