1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

lvmdbusd: Only allow 0..N for --blackboxsize argument

This commit is contained in:
Tony Asleson 2016-11-30 16:45:50 -06:00
parent c0a508cfab
commit c9848bb7ea

View File

@ -54,6 +54,14 @@ def process_request():
utils.log_error("process_request exception: \n%s" % st)
def check_bb_size(value):
v = int(value)
if v < 0:
raise argparse.ArgumentTypeError(
"positive integers only ('%s' invalid)" % value)
return v
def main():
start = time.time()
# Add simple command line handling
@ -80,7 +88,7 @@ def main():
"--blackboxsize",
help="Size of the black box flight recorder, 0 to disable",
default=10,
type=int,
type=check_bb_size,
dest='bb_size')
use_session = os.getenv('LVMDBUSD_USE_SESSION', False)