Re: Bug#799097: mrtg-rrd: Regression after the fix for bug #787608.
On Friday, 13 January 2017 15:24:54 CET Damyan Ivanov wrote:
> Perhaps somebody from the perl group (CC-ed) can take a look?
See below...
> > > --- a/mrtg-rrd.cgi
> > > +++ b/mrtg-rrd.cgi
> > > @@ -496,7 +496,7 @@ sub common_args($$$)
> > >
> > > {
> > >
> > > my ($name, $target, $q) = @_;
> > >
> > > - return @{$target->{args}} if defined @{$target->{args}};
> > > + return @{$target->{args}} if exists $target->{args};
A more defensive way is
return @{$target->{args}} if ref($target->{args}) eq 'ARRAY';
> > >
> > > my $noi = 1 if $target->{options}{noi};
> > > my $noo = 1 if $target->{options}{noo};
> > >
> > > @@ -521,7 +521,7 @@ sub common_args($$$)
> > >
> > > $target->{rrd} = $dir . '/' . $tdir . $name . '.rrd';
> > >
> > > %{$target->{options}} = ()
> > >
> > > - unless defined %{$target->{options}};
> > > + unless %{$target->{options}};
unless ref(target->{options}) eq 'HASH'
> > >
> > > $dir = $cfg->{workdir};
> > > $dir = $cfg->{imagedir}
> > >
> > > @@ -908,7 +908,7 @@ EOF
> > >
> > > print $directories{$dir}{bodytag};
> > >
> > > my $subdirs_printed;
> > >
> > > - if (defined @{$directories{$dir}{subdir}}) {
> > > + if (exists $directories{$dir}{subdir}) {
if (ref($directories{$dir}{subdir}) eq 'ARRAY')
> > >
> > > $subdirs_printed = 1;
> > > print <<EOF;
> > >
> > > <H1>MRTG subdirectories in the directory $dir1</H1>
> > >
> > > @@ -921,7 +921,7 @@ EOF
> > >
> > > print "</UL>\n";
> > >
> > > }
> > >
> > > - if (defined @{$directories{$dir}{target}}) {
> > > + if (exists $directories{$dir}{target}) {
if (ref($directories{$dir}{target}) eq 'ARRAY')
> > >
> > > print "<HR>\n" if defined $subdirs_printed;
> > > print <<EOF;
> > >
> > > <H1>MRTG graphs in the directory $dir1</H1>
HTH
--
https://github.com/dod38fr/ -o- http://search.cpan.org/~ddumont/
http://ddumont.wordpress.com/ -o- irc: dod at irc.debian.org
Reply to: