diff options
author | Stefan Raspl <stefan.raspl@de.ibm.com> | 2017-12-11 06:25:27 -0500 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2017-12-14 03:25:46 -0500 |
commit | 73fab6ffbd83795e38974bb438e7afce0242c61a (patch) | |
tree | e0d3e50c7854e9d77dcd5da69aebfbc88a40a4a1 /tools | |
parent | 822cfe3e4813c8f52199362b0e689fba9459ddc9 (diff) |
tools/kvm_stat: stop ignoring unhandled arguments
Unhandled arguments, which could easily include typos, are simply
ignored. We should be strict to avoid undetected typos.
To reproduce start kvm_stat with an extra argument, e.g.
'kvm_stat -d bnuh5ol' and note that this will actually work.
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/kvm/kvm_stat/kvm_stat | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat index bf65531570f5..aa3bc47af1d0 100755 --- a/tools/kvm/kvm_stat/kvm_stat +++ b/tools/kvm/kvm_stat/kvm_stat | |||
@@ -1517,7 +1517,9 @@ Press any other key to refresh statistics immediately. | |||
1517 | help='restrict statistics to guest by name', | 1517 | help='restrict statistics to guest by name', |
1518 | callback=cb_guest_to_pid, | 1518 | callback=cb_guest_to_pid, |
1519 | ) | 1519 | ) |
1520 | (options, _) = optparser.parse_args(sys.argv) | 1520 | options, unkn = optparser.parse_args(sys.argv) |
1521 | if len(unkn) != 1: | ||
1522 | sys.exit('Error: Extra argument(s): ' + ' '.join(unkn[1:])) | ||
1521 | try: | 1523 | try: |
1522 | # verify that we were passed a valid regex up front | 1524 | # verify that we were passed a valid regex up front |
1523 | re.compile(options.fields) | 1525 | re.compile(options.fields) |