mirror of
https://github.com/morgan9e/systemd
synced 2026-04-16 01:16:10 +09:00
test: use cap_last_cap() for max supported cap number, not capability_list_length()
This test assumes capability_list_length() is an invalid cap number, but that isn't true if the running kernel supports more caps than we were compiled with, which results in the test failing. Instead use cap_last_cap() + 1. If cap_last_cap() is 63, there are no more 'invalid' cap numbers to test with, so the invalid cap number test part is skipped.
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
9684a01ce4
commit
ebc815cd1c
@@ -50,6 +50,9 @@ int capability_from_name(const char *name) {
|
||||
return sc->id;
|
||||
}
|
||||
|
||||
/* This is the number of capability names we are *compiled* with.
|
||||
* For the max capability number of the currently-running kernel,
|
||||
* use cap_last_cap(). */
|
||||
int capability_list_length(void) {
|
||||
return (int) ELEMENTSOF(capability_names);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user