From patchwork Thu Feb 15 06:35:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Held X-Patchwork-Id: 1663 Return-Path: Received: from mail01.ipfire.org (unknown [172.28.1.200]) by web02.i.ipfire.org (Postfix) with ESMTP id 8B93960C10 for ; Wed, 14 Feb 2018 20:35:54 +0100 (CET) X-Virus-Scanned: ClamAV at mail01.ipfire.org Received: from mail01.i.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id 018DC105FC87; Wed, 14 Feb 2018 19:35:58 +0000 (GMT) Authentication-Results: mail01.ipfire.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: mail01.ipfire.org; spf=pass smtp.mailfrom=development-bounces@lists.ipfire.org X-Virus-Scanned: ClamAV at mail01.ipfire.org Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4F097105FC89 for ; Wed, 14 Feb 2018 19:35:53 +0000 (GMT) Authentication-Results: mail01.ipfire.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: mail01.ipfire.org; spf=pass smtp.mailfrom=berny156@gmx.de Received: from quad.berny.local ([46.244.233.56]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MDhny-1f0vl73QOU-00H7lm for ; Wed, 14 Feb 2018 20:35:32 +0100 From: Bernhard Held To: development@lists.ipfire.org Subject: [PATCH v3 2/4] Network::network2bin: return an empty list in case of error Date: Wed, 14 Feb 2018 20:35:20 +0100 Message-Id: <20180214193522.26880-3-berny156@gmx.de> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180214193522.26880-1-berny156@gmx.de> References: <20180214193522.26880-1-berny156@gmx.de> X-Provags-ID: V03:K0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hxaSU92BKjh /ZlRAIiFpPKAGjUxfIS3yNLNvZW1w== X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" 'return undef;' will always return a single value 'undef' even in list context. sub foo { return undef } if ( my @x = foo() ) { print "oops, we think we got a result"; } --- config/cfgroot/network-functions.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cfgroot/network-functions.pl b/config/cfgroot/network-functions.pl index 070e14d0f..7cd56f799 100644 --- a/config/cfgroot/network-functions.pl +++ b/config/cfgroot/network-functions.pl @@ -139,7 +139,7 @@ sub network2bin($) { my $netmask_bin = &ip2bin($netmask); if (!defined $address_bin || !defined $netmask_bin) { - return undef; + return (); } my $network_start = $address_bin & $netmask_bin;