Exit code should be 2 when the hostname can't be resolved (fixes #98)

pull/102/head
David Schweikert 9 years ago
parent 925ef8fe12
commit a37399ede9

@ -1,3 +1,7 @@
UNRELEASED
* (bugfix) Exit code should be 2 when the hostname can't be resolved
(fixes #98, reported by @green-fox)
2015-10-21 David Schweikert <david@schweikert.ch>
* Version 3.13
* (bugfix) Fix ICMP errors sometimes causing crashes with fping >= 3.11

@ -5,7 +5,7 @@ use Test::Command tests => 6;
# fping
{
my $cmd = Test::Command->new(cmd => "fping nosuchname.example.com");
$cmd->exit_is_num(1);
$cmd->exit_is_num(2);
$cmd->stdout_is_eq("");
$cmd->stderr_like(qr{^nosuchname\.example\.com: .*not (known|found)});
}
@ -13,7 +13,7 @@ $cmd->stderr_like(qr{^nosuchname\.example\.com: .*not (known|found)});
# fping6
{
my $cmd = Test::Command->new(cmd => "fping6 nosuchname.example.com");
$cmd->exit_is_num(1);
$cmd->exit_is_num(2);
$cmd->stdout_is_eq("");
$cmd->stderr_like(qr{^nosuchname\.example\.com: .*not (known|found)});
}

@ -777,8 +777,9 @@ int main( int argc, char **argv )
usage(1);
}
if( !num_hosts )
exit(1);
if(!num_hosts) {
exit(num_noaddress ? 2 : 1);
}
if(src_addr_present) {
socket_set_src_addr(s, src_addr);

Loading…
Cancel
Save