diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-01-10 17:18:08 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-01-10 17:18:08 +0100 |
commit | 7fb8be25e3e664ed30b91cd2a21a743823c383bd (patch) | |
tree | 1a66b86856d2787a636a3a00b9f5482559beeed8 | |
parent | c5721fd15c45441256487f8d2fc10c1bd25b6562 (diff) | |
download | fastd-7fb8be25e3e664ed30b91cd2a21a743823c383bd.tar fastd-7fb8be25e3e664ed30b91cd2a21a743823c383bd.zip |
Be less verbose about acquiring capabilities
-rw-r--r-- | src/capabilities.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/capabilities.c b/src/capabilities.c index e03ffb4..f2410c1 100644 --- a/src/capabilities.c +++ b/src/capabilities.c @@ -33,13 +33,23 @@ static void try_cap(fastd_context_t *ctx, cap_value_t cap) { char *name = cap_to_name(cap); - if (!name) return; - pr_debug(ctx, "Trying to acquire %s", name); - cap_t caps = cap_get_proc(); + if (!caps) + goto end_free; + + cap_flag_value_t val; + if (cap_get_flag(caps, cap, CAP_EFFECTIVE, &val) < 0) { + pr_debug_errno(ctx, "cap_get_flag"); + goto end_free; + } + + if (val == CAP_SET) + goto end_free; + + pr_verbose(ctx, "Trying to acquire %s", name); if (cap_set_flag(caps, CAP_EFFECTIVE, 1, &cap, CAP_SET) < 0) { pr_debug_errno(ctx, "cap_set_flags"); |