Revision: 7455 http://sourceforge.net/p/ipcop/svn/7455 Author: owes Date: 2014-04-11 08:11:40 +0000 (Fri, 11 Apr 2014) Log Message: ----------- Return value from getredIP can be 'unavailable', test for that to avoid an error message in gethostbyaddr. For reasons unknown the memory reported by free is 0 in very rare cases, test on that to avoid divide by 0 error.
Modified Paths: -------------- ipcop/trunk/html/cgi-bin/index.cgi ipcop/trunk/updates/2.1.5/ROOTFILES.i486-2.1.5 Modified: ipcop/trunk/html/cgi-bin/index.cgi =================================================================== --- ipcop/trunk/html/cgi-bin/index.cgi 2014-04-11 07:41:06 UTC (rev 7454) +++ ipcop/trunk/html/cgi-bin/index.cgi 2014-04-11 08:11:40 UTC (rev 7455) @@ -16,7 +16,7 @@ # along with IPCop. If not, see <http://www.gnu.org/licenses/>. # # (c) The SmoothWall Team -# (c) 2001-2012, the IPCop team +# (c) 2001-2014, the IPCop team # # $Id$ # @@ -112,8 +112,11 @@ # display our public internet IP my $fetch_ip = &General::GetDyndnsRedIP; - my $host_name = (gethostbyaddr(pack("C4", split(/\./, $fetch_ip)), 2))[0]; - if( (!defined(($host_name))) || ($host_name eq '') ) { + my $host_name; + if (defined($host_name) && ($host_name ne 'unavailable')) { + $host_name = (gethostbyaddr(pack("C4", split(/\./, $fetch_ip)), 2))[0]; + } + else { $host_name = $fetch_ip; } print @@ -153,10 +156,15 @@ my $mem = $1; $free[2] =~ m/(\d+)/; my $used = $1; -my $pct = int 100 * ($mem - $used) / $mem; -if ($used / $mem > 90) { - $warnmessage .= "<li> $Lang::tr{'high memory usage'}: $pct% !</li>\n"; +if ($mem) { + my $pct = int 100 * ($mem - $used) / $mem; + if ($used / $mem > 90) { + $warnmessage .= "<li> $Lang::tr{'high memory usage'}: $pct% !</li>\n"; + } } +else { + $warnmessage .= "<li> $Lang::tr{'high memory usage'}: 100% ! $Lang::tr{'memory'}=0M</li>\n"; +} # Diskspace usage warning my $free = &General::getavailabledisk('/root'); Modified: ipcop/trunk/updates/2.1.5/ROOTFILES.i486-2.1.5 =================================================================== --- ipcop/trunk/updates/2.1.5/ROOTFILES.i486-2.1.5 2014-04-11 07:41:06 UTC (rev 7454) +++ ipcop/trunk/updates/2.1.5/ROOTFILES.i486-2.1.5 2014-04-11 08:11:40 UTC (rev 7455) @@ -1,5 +1,6 @@ ## please place IPCop files first, then packages sorted by alphabetical order /home/httpd/cgi-bin/ddns.cgi +/home/httpd/cgi-bin/index.cgi /home/httpd/cgi-bin/iptablesgui.cgi /home/httpd/cgi-bin/upload.cgi /usr/local/bin/upgrade.sh This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test & Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees _______________________________________________ Ipcop-svn mailing list Ipcop-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ipcop-svn