From abbf6293642e1ca64f556ea05a3ea76bf51fe81f Mon Sep 17 00:00:00 2001 From: "David A. Madore" Date: Mon, 22 Feb 2010 18:47:28 +0100 Subject: It's true resolving the UDP and TCP protocols is pretty pointless. (Plus, it can add unpleasant dependencies in emergency situations.) --- emergencyd.pl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/emergencyd.pl b/emergencyd.pl index 6920e95..a0d5aa9 100755 --- a/emergencyd.pl +++ b/emergencyd.pl @@ -115,7 +115,6 @@ sub read_keys { } read_keys; -my $proto = getprotobyname("udp") or die "Can't resolve udp protocol: $!"; my $port; if ( defined($opts{p}) ) { $port = $opts{p}; @@ -124,7 +123,7 @@ if ( defined($opts{p}) ) { $port = DEFAULT_PORT; } -socket my $socket, PF_INET6, SOCK_DGRAM, $proto +socket my $socket, PF_INET6, SOCK_DGRAM, 0 or die "Can't create socket: $!"; if ( defined(*IPV6_V6ONLY{CODE}) ) { setsockopt $socket, IPPROTO_IPV6, IPV6_V6ONLY, 0 @@ -242,8 +241,7 @@ sub cmd_shel { my $port = shift or die [ "!BAD", "Missing argument to SHEL" ]; die [ "!BAD", "Invalid port number (SHEL command) $port" ] unless $port =~ /^\d+$/; - my $proto = getprotobyname("tcp") or die "Can't resolve tcp protocol: $!"; - socket my $socket, PF_INET6, SOCK_STREAM, $proto + socket my $socket, PF_INET6, SOCK_STREAM, 0 or die "Can't create socket: $!"; my $flags; $flags = fcntl ($socket, F_GETFL, 0); -- cgit v1.2.3