diff options
author | Renato Botelho <renato.botelho@bluepex.com> | 2010-09-20 12:58:49 -0300 |
---|---|---|
committer | Renato Botelho <renato.botelho@bluepex.com> | 2010-09-20 12:58:49 -0300 |
commit | af799b48b67cff7cde33c5b43a9aeb060c4f5e69 (patch) | |
tree | dea2ea6e55c40daae92af50df8ef8e775b91f3e6 /etc | |
parent | 389c778ec29d929a17843139f8cddf337b8fa9ad (diff) | |
download | pfsense-af799b48b67cff7cde33c5b43a9aeb060c4f5e69.zip pfsense-af799b48b67cff7cde33c5b43a9aeb060c4f5e69.tar.gz |
Fix write_rcfile() declaring $rcfileprefix as global and touching rcfile before check if it is writable
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/service-utils.inc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/etc/inc/service-utils.inc b/etc/inc/service-utils.inc index 281da52..925ff4f 100644 --- a/etc/inc/service-utils.inc +++ b/etc/inc/service-utils.inc @@ -41,9 +41,14 @@ $rcfileprefix = "/usr/local/etc/rc.d/"; function write_rcfile($params) { global $g; + global $rcfileprefix; + + if (!file_exists("{$rcfileprefix}{$params['file']}") && !touch("{$rcfileprefix}{$params['file']}")) + return false; if (!is_writable("{$rcfileprefix}{$params['file']}") || empty($params['start'])) return false; + $towrite = "#!/bin/sh\n"; $towrite .= "# This file was automatically generated\n# by the {$g['product_website']} service handler.\n\n"; @@ -75,6 +80,7 @@ function write_rcfile($params) { function start_service($name) { global $config; + global $rcfileprefix; /* make sure service is stopped before starting */ stop_service($name); @@ -106,6 +112,7 @@ function start_service($name) { function stop_service($name) { global $config; + global $rcfileprefix; if ($config['installedpackages']['service']) { foreach($config['installedpackages']['service'] as $service) { |