[systemd-devel] [PATCH 2/4] systemctl: check the argument to -t for invalid values
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Wed Jun 6 07:56:19 PDT 2012
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 2fbfd7e..cc0b999 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -4482,6 +4482,10 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
return 0;
case 't':
+ if (unit_type_from_string(optarg) == -1) {
+ log_error("Invalid unit type '%s'", optarg);
+ return -EINVAL;
+ }
arg_type = optarg;
break;
--
1.7.10.2.667.gf1138e2
More information about the systemd-devel
mailing list