summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorErmal LUÇI <eri@pfsense.org>2014-11-20 12:03:53 +0100
committerErmal LUÇI <eri@pfsense.org>2014-11-20 12:04:08 +0100
commit3e643dba7055371f2036bcc6115dd0a0fcb5033b (patch)
tree654acf51b02971ce4a24f050d91546561924be38 /etc
parent140183fd94295871167db51e02d9df4b29766873 (diff)
downloadpfsense-3e643dba7055371f2036bcc6115dd0a0fcb5033b.zip
pfsense-3e643dba7055371f2036bcc6115dd0a0fcb5033b.tar.gz
Make this code do proper checks in all cases
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/pkg-utils.inc14
1 files changed, 6 insertions, 8 deletions
diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc
index 923d130..902ee55 100644
--- a/etc/inc/pkg-utils.inc
+++ b/etc/inc/pkg-utils.inc
@@ -388,15 +388,13 @@ function sync_package($pkg_name, $sync_depends = true, $show_message = false) {
$pkg_id = get_pkg_id($pkg_name);
if($pkg_id == -1)
return -1; // This package doesn't really exist - exit the function.
- } else {
+ } else
$pkg_id = $pkg_name;
- if(empty($config['installedpackages']['package'][$pkg_id]))
- return; // No package belongs to the pkg_id passed to this function.
- }
- if (is_array($config['installedpackages']['package'][$pkg_id]))
- $package =& $config['installedpackages']['package'][$pkg_id];
- else
- return; /* empty package tag */
+
+ if(!is_array($config['installedpackages']['package'][$pkg_id]))
+ return; // No package belongs to the pkg_id passed to this function.
+
+ $package =& $config['installedpackages']['package'][$pkg_id];
if(!file_exists("/usr/local/pkg/" . $package['configurationfile'])) {
log_error(sprintf(gettext("The %s package is missing its configuration file and must be reinstalled."), $package['name']));
force_remove_package($package['name']);
OpenPOWER on IntegriCloud