perl-Net-IP/0001-fix-perl-shbang.patch
2022-01-22 20:19:29 +08:00

80 lines
2.0 KiB
Diff

From c4954baea55f227e28a2228a1b4425a7973b0d8d Mon Sep 17 00:00:00 2001
From: bzg1107 <preloyalwhite@163.com>
Date: Sat, 22 Jan 2022 19:33:24 +0800
Subject: [PATCH] fix perl shbang
---
IP.pm | 16 +++++++++++-----
ipcount | 2 +-
iptab | 2 +-
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/IP.pm b/IP.pm
index 0ff27ff..c6425e0 100644
--- a/IP.pm
+++ b/IP.pm
@@ -416,7 +416,9 @@ sub intip {
my $int = ip_bintoint($self->binip());
- if (!$int) {
+ # this then fails for 0.0.0.0, which is wrong.
+ #
+ if (not defined $int) {
$self->{error} = $ERROR;
$self->{errno} = $ERRNO;
return;
@@ -625,9 +627,11 @@ sub last_int {
return ($self->{last_int}) if defined($self->{last_int});
- my $last_bin = $self->last_bin() or return;
+ my $last_bin = $self->last_bin();
+ return unless defined $last_bin;
- my $last_int = ip_bintoint($last_bin, $self->version()) or return;
+ my $last_int = ip_bintoint($last_bin, $self->version());
+ return unless defined $last_int;
$self->{last_int} = $last_int;
@@ -1267,11 +1271,13 @@ sub ip_prefix_to_range {
# Turn into a binary
# Get last address
# Turn into an IP
- my $binip = ip_iptobin($ip, $ip_version) or return;
+ my $binip = ip_iptobin($ip, $ip_version);
+ return unless defined $binip;
return unless (ip_check_prefix($binip, $len, $ip_version));
- my $lastip = ip_last_address_bin($binip, $len, $ip_version) or return;
+ my $lastip = ip_last_address_bin($binip, $len, $ip_version);
+ return unless defined $lastip;
return unless ($lastip = ip_bintoip($lastip, $ip_version));
return ($ip, $lastip);
diff --git a/ipcount b/ipcount
index 5e98596..0871ca7 100755
--- a/ipcount
+++ b/ipcount
@@ -1,4 +1,4 @@
-#!perl -w
+#!/usr/bin/perl -w
# Copyright (c) 2000 RIPE NCC
#
diff --git a/iptab b/iptab
index 2c05789..6a7e4ae 100755
--- a/iptab
+++ b/iptab
@@ -1,4 +1,4 @@
-#!perl
+#!/usr/bin/perl
use Net::IP;
use strict;
--
2.30.0