chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0a9f8ed
)
systemctl: check the argument to -t for invalid values
author
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Wed, 6 Jun 2012 14:56:19 +0000
(16:56 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Tue, 10 Jul 2012 15:07:32 +0000
(17:07 +0200)
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
patch
|
blob
|
history
diff --git
a/src/systemctl/systemctl.c
b/src/systemctl/systemctl.c
index c89920bccbe7f7cbc0c9acfeb184018a63d9899b..a9681798dd55baef54e0ca1087c5fcfedd8180c3 100644
(file)
--- 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;