From 8bc0626c6595ce210df22011671dc2eff061f579 Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Tue, 30 Dec 2014 06:23:33 -0600 Subject: [PATCH] Fix error checking for socket connections - IO::Socket::UNIX->new should never die, therefore... - $@ is always undef when the eval exits, so... - use $! instead --- plugins/ident/p0f | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugins/ident/p0f b/plugins/ident/p0f index 59fe7c0..f7cbb9e 100644 --- a/plugins/ident/p0f +++ b/plugins/ident/p0f @@ -323,12 +323,9 @@ sub query_p0f_v3 { my $query = $self->get_v3_query() or return; # Open the connection to p0f - my $sock; - eval { - $sock = IO::Socket::UNIX->new(Peer => $p0f_socket, Type => SOCK_STREAM); - }; + my $sock = IO::Socket::UNIX->new(Peer => $p0f_socket, Type => SOCK_STREAM); if (!$sock) { - $self->log(LOGERROR, "skip, could not open socket: $@"); + $self->log(LOGERROR, "skip, could not open socket: $!"); return; }