[git commit] capability: fix string comparison in cap_name_to_number
Denys Vlasenko
vda.linux at googlemail.com
Mon Jan 21 11:50:37 UTC 2019
commit: https://git.busybox.net/busybox/commit/?id=11cb9eeffec0e2575c8722e83de3116f81b61b4f
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
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