From mboxrd@z Thu Jan  1 00:00:00 1970
From: Michael Tremer <michael.tremer@ipfire.org>
To: development@lists.ipfire.org
Subject: Re: [PATCH 2/3] network-functions.pl : Compare correct variables in
 network_equal
Date: Tue, 24 Dec 2019 14:04:21 +0100
Message-ID: <EFE3EFA0-3D9A-4098-997C-A1BEBCC3EBCC@ipfire.org>
In-Reply-To: <20191224125652.12232-3-ipfr@tfitzgeorge.me.uk>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============7770736468389987464=="
List-Id: <development.lists.ipfire.org>

--===============7770736468389987464==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Hello,

I am still not sure what you are trying to solve here.

&network2bin() has two possible return values:

1) An array with two values

Or

2) Undefined

You are now checking if you have an array with any length but two, but this w=
on=E2=80=99t work for undefined. That should at least print a warning that yo=
u are trying to determine the length of an undefined array.

So why is this change needed?

-Michael

> On 24 Dec 2019, at 13:56, Tim FitzGeorge <ipfr(a)tfitzgeorge.me.uk> wrote:
>=20
> Check result of network2bin is correct rather than checking non-existent
> variable.
>=20
> Signed-off-by: Tim FitzGeorge <ipfr(a)tfitzgeorge.me.uk>
> ---
> config/cfgroot/network-functions.pl | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>=20
> diff --git a/config/cfgroot/network-functions.pl b/config/cfgroot/network-f=
unctions.pl
> index 56b4bceb7..a3f574760 100644
> --- a/config/cfgroot/network-functions.pl
> +++ b/config/cfgroot/network-functions.pl
> @@ -111,7 +111,7 @@ sub network_equal {
> 	my @bin1 =3D &network2bin($network1);
> 	my @bin2 =3D &network2bin($network2);
>=20
> -	if (!defined $bin1 || !defined $bin2) {
> +	if (@bin1 !=3D 2 || @bin2 !=3D 2) {
> 		return undef;
> 	}
>=20
> --=20
> 2.16.4
>=20


--===============7770736468389987464==--