diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-10-04 11:33:30 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-10-04 11:33:30 +0200 |
commit | ac6e8be66ecf57d401fd60c927cf81d522c7a8b9 (patch) | |
tree | 38a432e0296cdec5f5572fdb46c713d2e31bf4ef /src | |
parent | load-fragment: do not create empty array (diff) | |
download | systemd-ac6e8be66ecf57d401fd60c927cf81d522c7a8b9.tar.xz systemd-ac6e8be66ecf57d401fd60c927cf81d522c7a8b9.zip |
core: use strv_isempty to check if supplementary_groups is empty
With the previous commit, we know that it will be NULL if empty, but
it's safe to always use strv_isempty() in case the code changes
in the future.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/execute.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/execute.c b/src/core/execute.c index e1c2a57cc6..afb11c6fb6 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -895,7 +895,7 @@ static int get_supplementary_groups(const ExecContext *c, const char *user, keep_groups = true; } - if (!c->supplementary_groups) + if (strv_isempty(c->supplementary_groups)) return 0; /* @@ -969,7 +969,7 @@ static int enforce_groups(const ExecContext *context, gid_t gid, assert(context); /* Handle SupplementaryGroups= even if it is empty */ - if (context->supplementary_groups) { + if (!strv_isempty(context->supplementary_groups)) { r = maybe_setgroups(ngids, supplementary_gids); if (r < 0) return r; @@ -4052,7 +4052,7 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) { fprintf(f, "%sDynamicUser: %s\n", prefix, yes_no(c->dynamic_user)); - if (strv_length(c->supplementary_groups) > 0) { + if (!strv_isempty(c->supplementary_groups)) { fprintf(f, "%sSupplementaryGroups:", prefix); strv_fprintf(f, c->supplementary_groups); fputs("\n", f); |