From bf7187eac4749a273ba449973d77bdd76c0c4ba3 Mon Sep 17 00:00:00 2001 From: Mitch Tishmack Date: Wed, 8 Feb 2017 21:56:39 -0600 Subject: [PATCH] Fix a silly logic error in my dns script First real bug in it for years, its served me well. --- bin.org | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin.org b/bin.org index 78b3349..3f9da3c 100644 --- a/bin.org +++ b/bin.org @@ -186,9 +186,11 @@ my $lookup = $input; if ( $lookup =~ /\d+[.]\d+[.]\d+[.]\d+/smx ) { $lookup = ( gethostbyaddr inet_aton($lookup), AF_INET )[0]; - die "Error: Unable to reverse lookup ip $input.\n" if ( $lookup eq q{} ); } +die "Error: Unable to reverse lookup ip $input.\n" + if ( !(defined $lookup) or $lookup eq q{} ); + my $ipv4 = gethostbyname $lookup; die "Error: $lookup doesn't have any known ip addresses\n"