[pmg-devel] [PATCH pmg-api 2/2] fix 'Use of uninitialized value $info'
Thomas Lamprecht
t.lamprecht at proxmox.com
Mon Jun 17 10:56:08 CEST 2019
On 6/11/19 3:27 PM, Mira Limbeck wrote:
> Return early if $info is not defined. This gets rid of the 'Use of
> uninitialized value $info' warning in the following 'split' call.
>
> Signed-off-by: Mira Limbeck <m.limbeck at proxmox.com>
> ---
> PMG/API2/Quarantine.pm | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/PMG/API2/Quarantine.pm b/PMG/API2/Quarantine.pm
> index a51cf1e..b17b7a2 100644
> --- a/PMG/API2/Quarantine.pm
> +++ b/PMG/API2/Quarantine.pm
> @@ -64,6 +64,7 @@ sub decode_spaminfo {
> $spamdesc = PMG::Utils::load_sa_descriptions([$salocaldir]) if !$spamdesc;
>
> my $res = [];
> + return $res if !defined($info);
if we early abort then maybe really early? I.e., before the call to
load_sa_descriptions which does a bunch of read IO on >50 files?
>
> foreach my $test (split (',', $info)) {
> my ($name, $score) = split (':', $test);
>
More information about the pmg-devel
mailing list