mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-22 22:03:43 +03:00
cap-list: rename capability_set_to_string_alloc() → capability_set_to_string()
We typically don't use the _alloc() suffix anymore for anything, hence drop it here too.
This commit is contained in:
parent
0cd90cf4f3
commit
8142d73574
@ -56,11 +56,11 @@ int capability_list_length(void) {
|
||||
return (int) ELEMENTSOF(capability_names);
|
||||
}
|
||||
|
||||
int capability_set_to_string_alloc(uint64_t set, char **s) {
|
||||
int capability_set_to_string(uint64_t set, char **ret) {
|
||||
_cleanup_free_ char *str = NULL;
|
||||
size_t n = 0;
|
||||
|
||||
assert(s);
|
||||
assert(ret);
|
||||
|
||||
for (unsigned i = 0; i <= cap_last_cap(); i++)
|
||||
if (set & (UINT64_C(1) << i)) {
|
||||
@ -88,8 +88,7 @@ int capability_set_to_string_alloc(uint64_t set, char **s) {
|
||||
|
||||
str[n > 0 ? n - 1 : 0] = '\0'; /* truncate the last space, if it's there */
|
||||
|
||||
*s = TAKE_PTR(str);
|
||||
|
||||
*ret = TAKE_PTR(str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -7,5 +7,5 @@ const char *capability_to_name(int id);
|
||||
int capability_from_name(const char *name);
|
||||
int capability_list_length(void);
|
||||
|
||||
int capability_set_to_string_alloc(uint64_t set, char **s);
|
||||
int capability_set_to_string(uint64_t set, char **ret);
|
||||
int capability_set_from_string(const char *s, uint64_t *set);
|
||||
|
@ -1671,7 +1671,7 @@ static BUS_DEFINE_SET_TRANSIENT_PARSE(proc_subset, ProcSubset, proc_subset_from_
|
||||
static BUS_DEFINE_SET_TRANSIENT_PARSE(preserve_mode, ExecPreserveMode, exec_preserve_mode_from_string);
|
||||
static BUS_DEFINE_SET_TRANSIENT_PARSE_PTR(personality, unsigned long, parse_personality);
|
||||
static BUS_DEFINE_SET_TRANSIENT_TO_STRING_ALLOC(secure_bits, "i", int32_t, int, "%" PRIi32, secure_bits_to_string_alloc_with_check);
|
||||
static BUS_DEFINE_SET_TRANSIENT_TO_STRING_ALLOC(capability, "t", uint64_t, uint64_t, "%" PRIu64, capability_set_to_string_alloc);
|
||||
static BUS_DEFINE_SET_TRANSIENT_TO_STRING_ALLOC(capability, "t", uint64_t, uint64_t, "%" PRIu64, capability_set_to_string);
|
||||
static BUS_DEFINE_SET_TRANSIENT_TO_STRING_ALLOC(namespace_flag, "t", uint64_t, unsigned long, "%" PRIu64, namespace_flags_to_string);
|
||||
static BUS_DEFINE_SET_TRANSIENT_TO_STRING(mount_flags, "t", uint64_t, unsigned long, "%" PRIu64, mount_propagation_flag_to_string_with_check);
|
||||
|
||||
|
@ -6195,7 +6195,7 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
|
||||
if (c->capability_bounding_set != CAP_ALL) {
|
||||
_cleanup_free_ char *str = NULL;
|
||||
|
||||
r = capability_set_to_string_alloc(c->capability_bounding_set, &str);
|
||||
r = capability_set_to_string(c->capability_bounding_set, &str);
|
||||
if (r >= 0)
|
||||
fprintf(f, "%sCapabilityBoundingSet: %s\n", prefix, str);
|
||||
}
|
||||
@ -6203,7 +6203,7 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
|
||||
if (c->capability_ambient_set != 0) {
|
||||
_cleanup_free_ char *str = NULL;
|
||||
|
||||
r = capability_set_to_string_alloc(c->capability_ambient_set, &str);
|
||||
r = capability_set_to_string(c->capability_ambient_set, &str);
|
||||
if (r >= 0)
|
||||
fprintf(f, "%sAmbientCapabilities: %s\n", prefix, str);
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ static int bus_print_property(const char *name, const char *expected_value, sd_b
|
||||
} else if (STR_IN_SET(name, "CapabilityBoundingSet", "AmbientCapabilities")) {
|
||||
_cleanup_free_ char *s = NULL;
|
||||
|
||||
r = capability_set_to_string_alloc(u, &s);
|
||||
r = capability_set_to_string(u, &s);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
@ -57,7 +57,7 @@ static void test_capability_set_one(uint64_t c, const char *t) {
|
||||
_cleanup_free_ char *t1 = NULL;
|
||||
uint64_t c1, c_masked = c & all_capabilities();
|
||||
|
||||
assert_se(capability_set_to_string_alloc(c, &t1) == 0);
|
||||
assert_se(capability_set_to_string(c, &t1) == 0);
|
||||
assert_se(streq(t1, t));
|
||||
|
||||
assert_se(capability_set_from_string(t1, &c1) == 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user