Project

General

Profile

« Previous | Next » 

Revision af799b48

Added by Renato Botelho almost 15 years ago

Fix write_rcfile() declaring $rcfileprefix as global and touching rcfile before check if it is writable

View differences:

etc/inc/service-utils.inc
41 41
$rcfileprefix = "/usr/local/etc/rc.d/";
42 42
function write_rcfile($params) {
43 43
	global $g;
44
	global $rcfileprefix;
45

  
46
	if (!file_exists("{$rcfileprefix}{$params['file']}") && !touch("{$rcfileprefix}{$params['file']}"))
47
		return false;
44 48

  
45 49
	if (!is_writable("{$rcfileprefix}{$params['file']}") || empty($params['start']))
46 50
		return false;
51

  
47 52
	$towrite = "#!/bin/sh\n";
48 53
	$towrite .= "# This file was automatically generated\n# by the {$g['product_website']} service handler.\n\n";
49 54

  
......
75 80

  
76 81
function start_service($name) {
77 82
	global $config;
83
	global $rcfileprefix;
78 84

  
79 85
	/* make sure service is stopped before starting */
80 86
	stop_service($name);
......
106 112

  
107 113
function stop_service($name) {
108 114
	global $config;
115
	global $rcfileprefix;
109 116

  
110 117
	if ($config['installedpackages']['service']) {
111 118
		foreach($config['installedpackages']['service'] as $service) {

Also available in: Unified diff