Skip to content

Commit

Permalink
tools/kvm_stat: stop ignoring unhandled arguments
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stefan-Raspl authored and bonzini committed Dec 14, 2017
1 parent 822cfe3 commit 73fab6f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/kvm/kvm_stat/kvm_stat
Original file line number Diff line number Diff line change
Expand Up @@ -1517,7 +1517,9 @@ Press any other key to refresh statistics immediately.
help='restrict statistics to guest by name',
callback=cb_guest_to_pid,
)
(options, _) = optparser.parse_args(sys.argv)
options, unkn = optparser.parse_args(sys.argv)
if len(unkn) != 1:
sys.exit('Error: Extra argument(s): ' + ' '.join(unkn[1:]))
try:
# verify that we were passed a valid regex up front
re.compile(options.fields)
Expand Down

0 comments on commit 73fab6f

Please sign in to comment.