← Commit list

4954d47ab

Bernhard Reutner-Fischer
Bernhard Reutner-Fischer
2008-06-18
FAILED Duration: 28s

Subject

- fixes from Tito

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

libbb/strrstr.c+7 -10
@@ -13,19 +13,16 @@
* The strrstr() function finds the last occurrence of the substring needle
* in the string haystack. The terminating nul characters are not compared.
*/
-char* strrstr(const char *haystack, const char *needle)
+char *strrstr(const char *haystack, const char *needle)
{
char *r = NULL;
-
- if (!needle[0])
- return r;
- while (1) {
- char *p = strstr(haystack, needle);
- if (!p)
- return r;
+
+ do {
+ char *p = strstr(haystack, needle);
+ if (p)
r = p;
- haystack = p + 1;
- }
+ } while (*haystack++);
+ return r;
}
#ifdef __DO_STRRSTR_TEST