summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/includes
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-10-09 11:10:19 -0300
committerRenato Botelho <renato@netgate.com>2015-10-09 11:11:31 -0300
commit8822be67ce3085c30a1127960d6c8ae1d7eb1876 (patch)
tree2d8095a1a8869c21e6ebd5cec39c967b159bf7e2 /src/usr/local/www/includes
parent3928c6f1bcf911097366f075994dc9a61716e6e3 (diff)
downloadpfsense-8822be67ce3085c30a1127960d6c8ae1d7eb1876.zip
pfsense-8822be67ce3085c30a1127960d6c8ae1d7eb1876.tar.gz
Ignore possible erroneously negative temperatures
It's based on 2 pull requests (#1800 and #1801) by nagyrobi
Diffstat (limited to 'src/usr/local/www/includes')
-rw-r--r--src/usr/local/www/includes/functions.inc.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/usr/local/www/includes/functions.inc.php b/src/usr/local/www/includes/functions.inc.php
index 2c48543..3bb3edd 100644
--- a/src/usr/local/www/includes/functions.inc.php
+++ b/src/usr/local/www/includes/functions.inc.php
@@ -233,8 +233,14 @@ function get_temp() {
$temp_out = get_single_sysctl("hw.acpi.thermal.tz0.temperature");
}
- // Remove 'C' from the end
- return rtrim($temp_out, 'C');
+ // Remove 'C' from the end and spaces
+ $temp_out = trim(rtrim($temp_out, 'C'));
+
+ if ($temp_out[0] == '-') {
+ return '';
+ }
+
+ return $temp_out;
}
/* Get mounted filesystems and usage. Do not display entries for virtual filesystems (e.g. devfs, nullfs, unionfs) */
OpenPOWER on IntegriCloud