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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2012-06-06 16:56:19 +02:00 committed by Lennart Poettering
parent 0a9f8ed00c
commit 6d97280899
1 changed files with 4 additions and 0 deletions

View File

@ -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;