libbb: make is_suffixed_with() return pointer inside string, not key.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2015-08-25 21:47:33 +02:00
parent 7448b513c8
commit 68acc0f835

View File

@ -39,8 +39,9 @@ char* FAST_FUNC is_suffixed_with(const char *string, const char *key)
ssize_t len_diff = strlen(string) - key_len; ssize_t len_diff = strlen(string) - key_len;
if (len_diff >= 0) { if (len_diff >= 0) {
if (strcmp(string + len_diff, key) == 0) { string += len_diff;
return (char*)key; if (strcmp(string, key) == 0) {
return (char*)string;
} }
} }