From 6d97280899a766ad7b4a6b07cc803709a08b364b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 6 Jun 2012 16:56:19 +0200 Subject: [PATCH] systemctl: check the argument to -t for invalid values Systemctl accepted anything as the argument for -t, and simply said '0 units found'. It is better to catch this user error early. --- src/systemctl/systemctl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index c89920bcc..a9681798d 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -4650,6 +4650,10 @@ static int systemctl_parse_argv(int argc, char *argv[]) { return 0; case 't': + if (unit_type_from_string(optarg) < 0) { + log_error("Invalid unit type '%s'.", optarg); + return -EINVAL; + } arg_type = optarg; break; -- 2.30.2