[git commit branch/1_30_stable] capability: fix string comparison in cap_name_to_number

Denys Vlasenko vda.linux at googlemail.com
Thu Feb 14 13:40:57 UTC 2019


commit: https://git.busybox.net/busybox/commit/?id=fa86b27e24afa54b8df18f48f55fbbef40b7c6a8
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/1_30_stable

The result of strcasecmp was being used incorrectly.  This function
returns 0 if the strings match.

Signed-off-by: Mark Marshall <mark.marshall at omicronenergy.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 libbb/capability.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libbb/capability.c b/libbb/capability.c
index 6587dcbf7..d0ae78b91 100644
--- a/libbb/capability.c
+++ b/libbb/capability.c
@@ -67,7 +67,7 @@ unsigned FAST_FUNC cap_name_to_number(const char *cap)
 		goto found;
 	}
 	for (i = 0; i < ARRAY_SIZE(capabilities); i++) {
-		if (strcasecmp(capabilities[i], cap) != 0)
+		if (strcasecmp(capabilities[i], cap) == 0)
 			goto found;
 	}
 	bb_error_msg_and_die("unknown capability '%s'", cap);


More information about the busybox-cvs mailing list