--- zzzz-none-000/linux-2.6.32.61/scripts/kallsyms.c 2013-06-10 09:43:48.000000000 +0000 +++ ar9-7330-650/linux-2.6.32.61/scripts/kallsyms.c 2011-10-21 12:21:44.000000000 +0000 @@ -22,6 +22,35 @@ #include #include #include +#ifdef __APPLE__ +/* Darwin has no memmem implementation, this one is ripped of the uClibc-0.9.28 source */ +void *memmem (const void *haystack, size_t haystack_len, + const void *needle, size_t needle_len) +{ + const char *begin; + const char *const last_possible + = (const char *) haystack + haystack_len - needle_len; + + if (needle_len == 0) + /* The first occurrence of the empty string is deemed to occur at + the beginning of the string. */ + return (void *) haystack; + + /* Sanity check, otherwise the loop might search through the whole + memory. */ + if (__builtin_expect (haystack_len < needle_len, 0)) + return NULL; + + for (begin = (const char *) haystack; begin <= last_possible; ++begin) + if (begin[0] == ((const char *) needle)[0] && + !memcmp ((const void *) &begin[1], + (const void *) ((const char *) needle + 1), + needle_len - 1)) + return (void *) begin; + + return NULL; +} +#endif #ifndef ARRAY_SIZE #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) @@ -109,7 +138,10 @@ if (rc != 3) { if (rc != EOF) { /* skip line */ - fgets(str, 500, in); + // hbl: remove fgets(...) warn_unused_result + if(!fgets(str, 500, in)) { + str[0] = '\0'; + } } return -1; }