openbsd-ports/net/monitoring-plugins/patches/patch-plugins-scripts_check...

25 lines
897 B
Plaintext

Fix unportable code which assumes sockaddr does not include a length field.
https://github.com/monitoring-plugins/monitoring-plugins/pull/1463
Index: plugins-scripts/check_ircd.pl
--- plugins-scripts/check_ircd.pl.orig
+++ plugins-scripts/check_ircd.pl
@@ -146,7 +146,6 @@ sub bindRemote ($$)
{
my ($in_remotehost, $in_remoteport) = @_;
my $proto = getprotobyname('tcp');
- my $sockaddr;
my $that;
my ($name, $aliases,$type,$len,$thataddr) = gethostbyname($in_remotehost);
@@ -154,8 +153,7 @@ sub bindRemote ($$)
print "IRCD UNKNOWN: Could not start socket ($!)\n";
exit $ERRORS{"UNKNOWN"};
}
- $sockaddr = 'S n a4 x8';
- $that = pack($sockaddr, AF_INET, $in_remoteport, $thataddr);
+ $that = pack_sockaddr_in ($in_remoteport, $thataddr);
if (!connect(ClientSocket, $that)) {
print "IRCD UNKNOWN: Could not connect socket ($!)\n";
exit $ERRORS{"UNKNOWN"};