diff options
author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-06-28 06:30:54 +0000 |
---|---|---|
committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-06-28 06:30:54 +0000 |
commit | 3b14ea6fdbb9be8cf0ca72a99bb018f05019bcdb (patch) | |
tree | 9a0864ad4cba8a153d13abae8e75f161c4f25c9c | |
parent | 03a70d67f9051ab0dca5f49fa5a2f5c66dc789e7 (diff) | |
download | zabbix-3b14ea6fdbb9be8cf0ca72a99bb018f05019bcdb.tar.gz zabbix-3b14ea6fdbb9be8cf0ca72a99bb018f05019bcdb.tar.xz zabbix-3b14ea6fdbb9be8cf0ca72a99bb018f05019bcdb.zip |
- fixed permissions of log files when starting as 'root' (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@2989 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/zabbix_agent/zabbix_agentd.c | 13 | ||||
-rw-r--r-- | src/zabbix_server/server.c | 14 |
3 files changed, 23 insertions, 5 deletions
@@ -1,5 +1,6 @@ Changes for 1.3: + - fixed permissions of log files when starting as 'root' (Alexei) - fixed agent crash while evaluating proc.mem[] (Alexei) - changed type of lastlogsize to long in structure METRIC (Alexei) - ZABBIX agent to bind even if TIME_WAIT sockets exist (Alexei) diff --git a/src/zabbix_agent/zabbix_agentd.c b/src/zabbix_agent/zabbix_agentd.c index 430864e6..fbb611cf 100644 --- a/src/zabbix_agent/zabbix_agentd.c +++ b/src/zabbix_agent/zabbix_agentd.c @@ -204,6 +204,12 @@ void daemon_init(void) } + /* Init log files */ + if(CONFIG_LOG_FILE == NULL) + zabbix_open_log(LOG_TYPE_SYSLOG,CONFIG_LOG_LEVEL,NULL); + else + zabbix_open_log(LOG_TYPE_FILE,CONFIG_LOG_LEVEL,CONFIG_LOG_FILE); + if( (pid = fork()) != 0 ) { exit( 0 ); @@ -552,11 +558,12 @@ int main(int argc, char **argv) /* Must be before init_config() */ init_metrics(); init_config(); - - if(CONFIG_LOG_FILE == NULL) + +/* Moved to daemon_init(), otherwise log files can be created as root */ +/* if(CONFIG_LOG_FILE == NULL) zabbix_open_log(LOG_TYPE_SYSLOG,CONFIG_LOG_LEVEL,NULL); else - zabbix_open_log(LOG_TYPE_FILE,CONFIG_LOG_LEVEL,CONFIG_LOG_FILE); + zabbix_open_log(LOG_TYPE_FILE,CONFIG_LOG_LEVEL,CONFIG_LOG_FILE);*/ load_user_parameters(); diff --git a/src/zabbix_server/server.c b/src/zabbix_server/server.c index 6ad642ac..e7148329 100644 --- a/src/zabbix_server/server.c +++ b/src/zabbix_server/server.c @@ -277,6 +277,15 @@ void daemon_init(void) } + if(CONFIG_LOG_FILE == NULL) + { + zabbix_open_log(LOG_TYPE_SYSLOG,CONFIG_LOG_LEVEL,NULL); + } + else + { + zabbix_open_log(LOG_TYPE_FILE,CONFIG_LOG_LEVEL,CONFIG_LOG_FILE); + } + if( (pid = fork()) != 0 ) { exit( 0 ); @@ -612,14 +621,15 @@ int main(int argc, char **argv) sigaction(SIGTERM, &phan, NULL); sigaction(SIGPIPE, &phan, NULL); - if(CONFIG_LOG_FILE == NULL) +/* Moved to daemon_init() */ +/* if(CONFIG_LOG_FILE == NULL) { zabbix_open_log(LOG_TYPE_SYSLOG,CONFIG_LOG_LEVEL,NULL); } else { zabbix_open_log(LOG_TYPE_FILE,CONFIG_LOG_LEVEL,CONFIG_LOG_FILE); - } + }*/ if( FAIL == create_pid_file(CONFIG_PID_FILE)) { |