safer -i option parsing

pull/106/head
David Schweikert 8 years ago
parent 32ab06bdd1
commit 64af251a33

@ -1,8 +1,8 @@
#!/usr/bin/perl -w
use Test::Command tests => 30;
use Test::Command tests => 33;
for my $arg (qw(b B c C H O p Q r t)) {
for my $arg (qw(b B c C H i O p Q r t)) {
my $cmd = Test::Command->new(cmd => "fping -$arg xxx");
$cmd->exit_is_num(1);
$cmd->stdout_is_eq("");

@ -400,12 +400,14 @@ int main( int argc, char **argv )
break;
case 'r':
if (!sscanf(optarg,"%i",&retry))
if (!sscanf(optarg,"%u",&retry))
usage(1);
break;
case 'i':
interval = ( unsigned int )atoi( optarg ) * 100;
if (!sscanf(optarg,"%u",&interval))
usage(1);
interval *= 100;
break;
case 'p':

Loading…
Cancel
Save