summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-10-29 22:51:00 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-10-30 00:18:24 -0400
commitf971bf69e3e7d188e1cd7fa77fc7cd990e1b904e (patch)
tree71cb749df90b61a2a3d44d62a677e83acf9ed66f
parent281593c1e9ba587165442ef33cb8bec2c52f2494 (diff)
systemctl: obey --state in list-unit-files
(cherry picked from commit fec1530e6b5b8d6dc352c7338010357126e84621) Conflicts: src/systemctl/systemctl.c
-rw-r--r--src/systemctl/systemctl.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index cca1fbbea..85798e28d 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -777,6 +777,11 @@ static int compare_unit_file_list(const void *a, const void *b) {
static bool output_show_unit_file(const UnitFileList *u) {
const char *dot;
+ if (!strv_isempty(arg_states)) {
+ if (!strv_find(arg_states, unit_file_state_to_string(u->state)))
+ return false;
+ }
+
return !arg_types || ((dot = strrchr(u->path, '.')) && strv_find(arg_types, dot+1));
}