summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2010-02-22 17:47:28 (GMT)
committerDavid A. Madore <david+git@madore.org>2010-02-22 17:47:28 (GMT)
commitabbf6293642e1ca64f556ea05a3ea76bf51fe81f (patch)
treed3a8e4c0903892365f260867274e13439a3d8512
parent4858d50fbcfad7970c827e0ae4784da2f2230e25 (diff)
downloademergency-abbf6293642e1ca64f556ea05a3ea76bf51fe81f.zip
emergency-abbf6293642e1ca64f556ea05a3ea76bf51fe81f.tar.gz
emergency-abbf6293642e1ca64f556ea05a3ea76bf51fe81f.tar.bz2
It's true resolving the UDP and TCP protocols is pretty pointless.
(Plus, it can add unpleasant dependencies in emergency situations.)
-rwxr-xr-xemergencyd.pl6
1 files 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);