Fix warnings
authorJamie Cameron <jcameron@webmin.com>
Wed, 22 Jun 2011 18:28:26 +0000 (11:28 -0700)
committerJamie Cameron <jcameron@webmin.com>
Wed, 22 Jun 2011 18:28:26 +0000 (11:28 -0700)
web-lib-funcs.pl
webmin/webmin-lib.pl

index a877b94..3fa0416 100755 (executable)
@@ -4123,6 +4123,7 @@ if ($> == 0 && $< != 0 && !$ENV{'FOREIGN_MODULE_NAME'}) {
 $config_file = "$config_directory/config";
 %gconfig = ( );
 &read_file_cached($config_file, \%gconfig);
+$gconfig{'webprefix'} = '' if (!exists($gconfig{'webprefix'}));
 $null_file = $gconfig{'os_type'} eq 'windows' ? "NUL" : "/dev/null";
 $path_separator = $gconfig{'os_type'} eq 'windows' ? ';' : ':';
 
index c787d5b..630919b 100755 (executable)
@@ -1333,11 +1333,11 @@ allowed.
 =cut
 sub shared_root_directory
 {
-if ($gconfig{'shared_root'} eq '1') {
+if (exists($gconfig{'shared_root'}) && $gconfig{'shared_root'} eq '1') {
        # Always shared
        return 1;
        }
-elsif ($gconfig{'shared_root'} eq '0') {
+elsif (exists($gconfig{'shared_root'}) && $gconfig{'shared_root'} eq '0') {
        # Definately not shared
        return 0;
        }
@@ -2001,16 +2001,18 @@ foreach my $u (@$allupdates) {
 
        # Skip if wrong version of Webmin, unless this is non-core module and
        # we are handling them too
-       next if (($u->[1] >= $bversion + .01 ||
-                 $u->[1] <= $bversion ||
-                 $u->[1] <= $version) &&
+       my $nver = $u->[1];
+       $nver =~ s/^(\d+\.\d+)\..*$/$1/;
+       next if (($nver >= $bversion + .01 ||
+                 $nver <= $bversion ||
+                 $nver <= $version) &&
                 (!%info || $info{'longdesc'} || !$third));
 
        # Skip if not installed, unless installing new
        next if (!%info && !$missing);
 
        # Skip if module has a version, and we already have it
-       next if (%info && $info{'version'} && $info{'version'} >= $u->[1]);
+       next if (%info && $info{'version'} && $info{'version'} >= $nver);
 
        # Skip if not supported on this OS
        my $osinfo = { 'os_support' => $u->[3] };