From: Zbigniew Jędrzejewski-Szmek Date: Wed, 6 Jun 2012 14:56:19 +0000 (+0200) Subject: systemctl: check the argument to -t for invalid values X-Git-Tag: v187~146 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=6d97280899a766ad7b4a6b07cc803709a08b364b 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. --- 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;