From: Robert Spier Date: Wed, 29 Nov 2000 02:25:39 +0000 (-0500) Subject: Re: Minor suggestion for Sys::Syslog [PATCH] X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7c40f2ffc905b2d7d020da9a2debf52b63f9f0d9;p=p5sagit%2Fp5-mst-13.2.git Re: Minor suggestion for Sys::Syslog [PATCH] Message-ID: <14884.44915.86028.422238@localhost.localdomain> More checking in case someone has broken their services or protocol databases. p4raw-id: //depot/perl@7918 --- diff --git a/ext/Sys/Syslog/Syslog.pm b/ext/Sys/Syslog/Syslog.pm index c7ce3de..92b82a1 100644 --- a/ext/Sys/Syslog/Syslog.pm +++ b/ext/Sys/Syslog/Syslog.pm @@ -274,8 +274,8 @@ sub connect { ($host) = $host_uniq =~ /([A-Za-z0-9_.-]+)/; # allow FQDN (inc _) } unless ( $sock_type ) { - my $udp = getprotobyname('udp'); - my $syslog = getservbyname('syslog','udp'); + my $udp = getprotobyname('udp') || croak "getprotobyname failed for udp"; + my $syslog = getservbyname('syslog','udp') || croak "getservbyname failed"; my $this = sockaddr_in($syslog, INADDR_ANY); my $that = sockaddr_in($syslog, inet_aton($host) || croak "Can't lookup $host"); socket(SYSLOG,AF_INET,SOCK_DGRAM,$udp) || croak "socket: $!";