diff options
author | jim-p <jimp@pfsense.org> | 2013-03-29 11:57:21 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2013-03-29 11:58:57 -0400 |
commit | 3d74b8033534f521c8caa4c5084ae3f633c38cfd (patch) | |
tree | 605eae543f04b161237bb6f733b4b9cbae99a107 /etc/inc/pfsense-utils.inc | |
parent | a8f5790a30d1b510833264da48f082da2ef6201c (diff) | |
download | pfsense-3d74b8033534f521c8caa4c5084ae3f633c38cfd.zip pfsense-3d74b8033534f521c8caa4c5084ae3f633c38cfd.tar.gz |
Use is_module_loaded() to test these to avoid code duplication.
Diffstat (limited to 'etc/inc/pfsense-utils.inc')
-rw-r--r-- | etc/inc/pfsense-utils.inc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index f172b58..73a2b22 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -1566,8 +1566,7 @@ function load_crypto() { if (!in_array($config['system']['crypto_hardware'], $crypto_modules)) return false; - $is_loaded = `/sbin/kldstat | /usr/bin/grep -c {$config['system']['crypto_hardware']}`; - if (!empty($config['system']['crypto_hardware']) && ($is_loaded == 0)) { + if (!empty($config['system']['crypto_hardware']) && !is_module_loaded($config['system']['crypto_hardware'])) { log_error("Loading {$config['system']['crypto_hardware']} cryptographic accelerator module."); mwexec("/sbin/kldload {$config['system']['crypto_hardware']}"); } @@ -1583,8 +1582,7 @@ function load_thermal_hardware() { if (!in_array($config['system']['thermal_hardware'], $thermal_hardware_modules)) return false; - $is_loaded = `/sbin/kldstat | /usr/bin/grep -c {$config['system']['thermal_hardware']}`; - if (!empty($config['system']['thermal_hardware']) && ($is_loaded == 0)) { + if (!empty($config['system']['thermal_hardware']) && !is_module_loaded($config['system']['thermal_hardware'])) { log_error("Loading {$config['system']['thermal_hardware']} thermal monitor module."); mwexec("/sbin/kldload {$config['system']['thermal_hardware']}"); } |