diff options
author | Filipe Brandenburger <filbranden@google.com> | 2014-12-23 22:51:40 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-12-25 16:55:41 +0100 |
commit | 097df453dab149f6b45f1b30510363acd8f11593 (patch) | |
tree | efce4f6877cc8a3076b291b751068db93ef7a5a1 /src/shared/cap-list.c | |
parent | udev: fix another strict aliasing issue (diff) | |
download | systemd-097df453dab149f6b45f1b30510363acd8f11593.tar.xz systemd-097df453dab149f6b45f1b30510363acd8f11593.zip |
test: do not use last cap from kernel in test-cap-list
The new test-cap-list introduced in commit 2822da4fb7f891 uses the included
table of capabilities. However, it uses cap_last_cap() which probes the kernel
for the last available capability. On an older kernel (e.g. 3.10 from RHEL 7)
that causes the test to fail with the following message:
Assertion '!capability_to_name(cap_last_cap()+1)' failed at src/test/test-cap-list.c:30, function main(). Aborting.
Fix it by exporting the size of the static table and using it in the test
instead of the dynamic one from the current kernel.
Tested by successfully running ./test-cap-list and the whole `make check` test
suite with this patch on a RHEL 7 host.
Diffstat (limited to 'src/shared/cap-list.c')
-rw-r--r-- | src/shared/cap-list.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/shared/cap-list.c b/src/shared/cap-list.c index 56d1488f48..8033e8c7b2 100644 --- a/src/shared/cap-list.c +++ b/src/shared/cap-list.c @@ -60,3 +60,7 @@ int capability_from_name(const char *name) { return sc->id; } + +int capability_list_length(void) { + return (int) ELEMENTSOF(capability_names); +} |