capability: fix string comparison in cap_name_to_number

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

Signed-off-by: Mark Marshall <mark.marshall@omicronenergy.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Mark Marshall 2019-01-18 09:10:34 +01:00 committed by Denys Vlasenko
parent fc472ea187
commit 11cb9eeffe

View File

@ -67,7 +67,7 @@ unsigned FAST_FUNC cap_name_to_number(const char *cap)
goto found; goto found;
} }
for (i = 0; i < ARRAY_SIZE(capabilities); i++) { for (i = 0; i < ARRAY_SIZE(capabilities); i++) {
if (strcasecmp(capabilities[i], cap) != 0) if (strcasecmp(capabilities[i], cap) == 0)
goto found; goto found;
} }
bb_error_msg_and_die("unknown capability '%s'", cap); bb_error_msg_and_die("unknown capability '%s'", cap);