Commit 73fab6ff authored by Stefan Raspl's avatar Stefan Raspl Committed by Paolo Bonzini

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: default avatarStefan Raspl <raspl@linux.vnet.ibm.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 822cfe3e
...@@ -1517,7 +1517,9 @@ Press any other key to refresh statistics immediately. ...@@ -1517,7 +1517,9 @@ Press any other key to refresh statistics immediately.
help='restrict statistics to guest by name', help='restrict statistics to guest by name',
callback=cb_guest_to_pid, 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: try:
# verify that we were passed a valid regex up front # verify that we were passed a valid regex up front
re.compile(options.fields) re.compile(options.fields)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment