From 6d97280899a766ad7b4a6b07cc803709a08b364b Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Wed, 6 Jun 2012 16:56:19 +0200 Subject: 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(+) (limited to 'src') diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index c89920bccb..a9681798dd 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; -- cgit v1.2.3-54-g00ecf