From: Ian Campbell Subject: Re: [OSSTEST PATCH] DhcpWatch::leases: Check errors Date: Mon, 3 Nov 2014 10:40:53 +0000 Message-ID: <1415011253.9994.15.camel@citrix.com> References: <1414754490-30355-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XlF4D-0002mV-Rp for xen-devel@lists.xenproject.org; Mon, 03 Nov 2014 10:40:57 +0000 In-Reply-To: <1414754490-30355-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Fri, 2014-10-31 at 11:21 +0000, Ian Jackson wrote: > Check error returns from connect() et al (which present as an undef > return from IO::Socket::INET), and from read() (which can be detected > via IO::Handle::error). > > Signed-off-by: Ian Jackson Looks like you have a mixture of tabs and spaces in the second hunk, but otherwise: Acked-by: Ian Campbell > --- > Osstest/DhcpWatch/leases.pm | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/Osstest/DhcpWatch/leases.pm b/Osstest/DhcpWatch/leases.pm > index 6f142e7..9a74c40 100644 > --- a/Osstest/DhcpWatch/leases.pm > +++ b/Osstest/DhcpWatch/leases.pm > @@ -58,6 +58,7 @@ sub check_ip ($$) { > if (!defined $leases) { return "open $leasesfn: $!"; } > } else { > $leases= new IO::Socket::INET(PeerAddr => $leasesfn); > + if (!defined $leases) { return "connect to $leasesfn: $!"; } > } > > my $lstash= "dhcpleases-$gho->{Guest}"; > @@ -163,6 +164,9 @@ sub check_ip ($$) { > > if (!$best) { > $saveas->("$lstash.nolease", 3); > + if ($leases->error) { > + return "error reading $leasesfn"; > + } > return "no active lease"; > } > $gho->{Ip}= $best->{' addr'};