From: Yu Watanabe Date: Thu, 23 Oct 2025 14:17:36 +0000 (+0900) Subject: test: replace cap_to_text() with capability_get() and capability_set_to_string() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=96f2255637f49caf8e1a987ab56c9fd4058fd46f;p=thirdparty%2Fsystemd.git test: replace cap_to_text() with capability_get() and capability_set_to_string() --- diff --git a/src/test/test-capability-util.c b/src/test/test-capability-util.c index ef04e77a5c9..c49fadfd7bb 100644 --- a/src/test/test-capability-util.c +++ b/src/test/test-capability-util.c @@ -13,6 +13,7 @@ #define TEST_CAPABILITY_C #include "alloc-util.h" +#include "capability-list.h" #include "capability-util.h" #include "errno-util.h" #include "fd-util.h" @@ -84,18 +85,15 @@ static void fork_test(void (*test_func)(void)) { } static void show_capabilities(void) { - cap_t caps; - char *text; + _cleanup_free_ char *e = NULL, *p = NULL, *i = NULL; + CapabilityQuintet q; - caps = cap_get_proc(); - assert_se(caps); + ASSERT_OK(capability_get(&q)); + ASSERT_OK(capability_set_to_string(q.effective, &e)); + ASSERT_OK(capability_set_to_string(q.permitted, &p)); + ASSERT_OK(capability_set_to_string(q.inheritable, &i)); - text = cap_to_text(caps, NULL); - assert_se(text); - - log_info("Capabilities:%s", text); - cap_free(caps); - cap_free(text); + log_info("Capabilities:e=%s p=%s, i=%s", e, p, i); } static int setup_tests(bool *run_ambient) {