mirror of
https://github.com/clearlinux/systemd-stable.git
synced 2026-09-06 13:41:31 +00:00
systemctl: let list-{units,unit-files } honour --type
The docs don't clarify what is expected, but I don't see any reason
why --type should be ignored.
Also restucture the compund conditions into separate clauses for
easier reading.
(cherry picked from commit 6c71341aee)
Conflicts:
src/systemctl/systemctl.c
This commit is contained in:
@@ -277,8 +277,10 @@ static int compare_unit_info(const void *a, const void *b) {
|
||||
static bool output_show_unit(const struct unit_info *u) {
|
||||
const char *dot;
|
||||
|
||||
if (!strv_isempty(arg_states))
|
||||
return strv_contains(arg_states, u->load_state) || strv_contains(arg_states, u->sub_state) || strv_contains(arg_states, u->active_state);
|
||||
if (!strv_isempty(arg_states)) {
|
||||
if (!strv_contains(arg_states, u->load_state) && !strv_contains(arg_states, u->sub_state) && !strv_contains(arg_states, u->active_state))
|
||||
return false;
|
||||
}
|
||||
|
||||
return (!arg_types || ((dot = strrchr(u->id, '.')) &&
|
||||
strv_find(arg_types, dot+1))) &&
|
||||
|
||||
Reference in New Issue
Block a user