We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I get the following error lots of times: Use of uninitialized value $host in substitution (s///) at ./mytop line 958.
This happens when gethostbyaddr returns null. In that case we should show the IP instead:
From 602d063dbac4ae94b2d2273ceef9fbf01f9ca1d9 Mon Sep 17 00:00:00 2001 From: Christoph Brill <[email protected]> Date: Tue, 27 Aug 2013 16:11:13 +0200 Subject: [PATCH] If gethostbyaddr return nothing, keep using the IP --- mytop | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mytop b/mytop index fba27fd..8d6bf42 100755 --- a/mytop +++ b/mytop @@ -955,8 +955,11 @@ sub GetData() { $thread->{Host} =~ s/:\d+$//; my $host = gethostbyaddr(inet_aton($thread->{Host}), AF_INET); - $host =~ s/^([^.]+).*/$1/; - $thread->{Host} = $host; + if ($host) + { + $host =~ s/^([^.]+).*/$1/; + $thread->{Host} = $host; + } } ## Fix possible undefs -- 1.8.4
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I get the following error lots of times:
Use of uninitialized value $host in substitution (s///) at ./mytop line 958.
This happens when gethostbyaddr returns null. In that case we should show the IP instead:
The text was updated successfully, but these errors were encountered: