Commit 14229b81 authored by Dan Carpenter's avatar Dan Carpenter Committed by Daniel Borkmann

libbpf: Fix str_has_sfx()'s return value

The return from strcmp() is inverted so it wrongly returns true instead
of false and vice versa.

Fixes: a1c9d61b ("libbpf: Improve library identification for uprobe binary path resolution")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
Cc: Alan Maguire <alan.maguire@oracle.com>
Link: https://lore.kernel.org/bpf/YtZ+/dAA195d99ak@kili
parent c6018fc6
...@@ -108,9 +108,9 @@ static inline bool str_has_sfx(const char *str, const char *sfx) ...@@ -108,9 +108,9 @@ static inline bool str_has_sfx(const char *str, const char *sfx)
size_t str_len = strlen(str); size_t str_len = strlen(str);
size_t sfx_len = strlen(sfx); size_t sfx_len = strlen(sfx);
if (sfx_len <= str_len) if (sfx_len > str_len)
return strcmp(str + str_len - sfx_len, sfx); return false;
return false; return strcmp(str + str_len - sfx_len, sfx) == 0;
} }
/* Symbol versioning is different between static and shared library. /* Symbol versioning is different between static and shared library.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment