mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Handle invalid options in arc_summary
If an invalid option is provided to arc_summary.py we handle any error thrown from the getopt Python module and print the usage help message. Reviewed-by: George Melikov <mail@gmelikov.ru> Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: loli10K <ezomori.nozomu@gmail.com> Closes #6983
This commit is contained in:
@@ -977,9 +977,15 @@ def main():
|
||||
global show_tunable_descriptions
|
||||
global alternate_tunable_layout
|
||||
|
||||
opts, args = getopt.getopt(
|
||||
sys.argv[1:], "adp:h", ["alternate", "description", "page=", "help"]
|
||||
)
|
||||
try:
|
||||
opts, args = getopt.getopt(
|
||||
sys.argv[1:],
|
||||
"adp:h", ["alternate", "description", "page=", "help"]
|
||||
)
|
||||
except getopt.error as e:
|
||||
sys.stderr.write("Error: %s\n" % e.msg)
|
||||
usage()
|
||||
sys.exit(1)
|
||||
|
||||
args = {}
|
||||
for opt, arg in opts:
|
||||
@@ -991,7 +997,7 @@ def main():
|
||||
args['p'] = arg
|
||||
if opt in ('-h', '--help'):
|
||||
usage()
|
||||
sys.exit()
|
||||
sys.exit(0)
|
||||
|
||||
Kstat = get_Kstat()
|
||||
|
||||
@@ -1006,7 +1012,7 @@ def main():
|
||||
except IndexError:
|
||||
sys.stderr.write('the argument to -p must be between 1 and ' +
|
||||
str(len(unSub)) + '\n')
|
||||
sys.exit()
|
||||
sys.exit(1)
|
||||
else:
|
||||
pages = unSub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user